Advertisement
TimxAG

Untitled

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