Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.
#include <stdio.h>
int ans,l,i;
int main()
{
char ch[110];
scanf(“%s”,ch);
for( ; ch[i+1]; i++)
{
l++;
if(ch[i]==’V’ && ch[i+1]==’K’)
ans++,ch[i]=’#’,ch[i+1]=’#’,i++;
}
l++;
for(i=0; ch[i+1]; i++)
{
if((ch[i]==’V’ && ch[i+1]==’V’) || (ch[i]==’K’&&ch[i+1]==’K’))
{
ans++;
break;
}
}
printf(“%d”,ans);
}
📦 Looking for Codeforces Round 409 Div Based Vk? Check the best deals on Amazon.
🛒 Shop Codeforces Round 409 Div Based Vk on Amazon
As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.
Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.
#include <stdio.h>
int ans,l,i;
int main()
{
char ch[110];
scanf(“%s”,ch);
for( ; ch[i+1]; i++)
{
l++;
if(ch[i]==’V’ && ch[i+1]==’K’)
ans++,ch[i]=’#’,ch[i+1]=’#’,i++;
}
l++;
for(i=0; ch[i+1]; i++)
{
if((ch[i]==’V’ && ch[i+1]==’V’) || (ch[i]==’K’&&ch[i+1]==’K’))
{
ans++;
break;
}
}
printf(“%d”,ans);
}
📦 Looking for Codeforces Round 409 Div Based Vk? Check the best deals on Amazon.
🛒 Shop Codeforces Round 409 Div Based Vk on Amazon
As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.