Skip to content

Instantly share code, notes, and snippets.

@ik11235
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ik11235/7642fbf7be3ee2ec62ec to your computer and use it in GitHub Desktop.
Save ik11235/7642fbf7be3ee2ec62ec to your computer and use it in GitHub Desktop.
class TaroFillingAStringDiv2 {
public:
int getNumber(string S) {
if(S.size()<2)
return 0;
int ans=0;
int i=0;
while(S[i]=='?')
i++;
for (; i < s.size(); i++) {
if(S[i]=='?')
{
if(S[i-1]=='A')
S[i]=='B';
else
S[i]=='A';
}
if(s[i-1]==s[i])
ans++;
}
return ans;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment