Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- string st; int count=0,i;
- bool f=false;
- cin >> st;//cout << st.size();
- int sos[st.size()];fill(sos,sos+st.size(),0);
- fo(i,st.size()-1)
- if (sos[i]==0)
- {
- //cout << "1";
- if ((st[i]=='V') && (st[i+1]=='K')) { sos[i]++;sos[i+1]++;count ++ ; }
- if (!f)
- if (((st[i] == 'V') && (st[i+1]=='V')) || ((st[i]=='K') && (st[i+1]=='K'))) { sos[i]++;sos[i+1]++;f=true;count ++ ;}
- }//else cout << sos[i] << " ";
- cout << count;
- return 0;
- }
Add Comment
Please, Sign In to add comment