TimxAG

Untitled

Apr 16th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. int main()
  2. {
  3. string st; int count=0,i;
  4. bool f=false;
  5. cin >> st;//cout << st.size();
  6. int sos[st.size()];fill(sos,sos+st.size(),0);
  7. fo(i,st.size()-1)
  8. if (sos[i]==0)
  9. {
  10. //cout << "1";
  11. if ((st[i]=='V') && (st[i+1]=='K')) { sos[i]++;sos[i+1]++;count ++ ; }
  12. if (!f)
  13. if (((st[i] == 'V') && (st[i+1]=='V')) || ((st[i]=='K') && (st[i+1]=='K'))) { sos[i]++;sos[i+1]++;f=true;count ++ ;}
  14. }//else cout << sos[i] << " ";
  15. cout << count;
  16. return 0;
  17. }
Add Comment
Please, Sign In to add comment