Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- char s[110];
- scanf("%s", s);
- int i;
- int cnt = 0;
- for(i = 0; i < strlen(s); i++)
- {
- if(s[i] == 'V' && s[i+1] == 'K')
- {
- s[i] = '#';
- s[i+1] = '#';
- cnt++;
- }
- }
- for(i = 0; i < strlen(s); i++)
- {
- if((s[i] == 'V' && s[i+1] == 'V') || (s[i] == 'K' && s[i+1] == 'K'))
- {
- s[i] = 'V';
- s[i+1] = 'K';
- cnt++;
- break;
- }
- }
- //for(i = 0; i < strlen(s); i++) printf("%c", s[i]);
- printf("%d\n", cnt);
- }
Advertisement
Add Comment
Please, Sign In to add comment