Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2), problem: (A) Vicious Keyboard Solution In C/C++

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.

More from author

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related posts

Advertismentspot_img

Latest posts

How Viral Kitchen Gadgets Is Quietly Changing the Game

📢 As an Amazon Associate, I earn from qualifying purchases.I stumbled across this while desperately trying to fix a recurring problem in my routine....

Lil Durk Found Not Guilty in Federal Murder-for-Hire Trial

In a dramatic conclusion to one of the hip-hop community's most closely watched legal battles, Chicago rapper Lil Durk has been found not guilty...

The Ultimate Viral Kitchen Gadgets Guide You Didnt Know You Needed

📢 As an Amazon Associate, I earn from qualifying purchases.I stumbled across this while desperately trying to fix a recurring problem in my routine....

Want to stay up to date with the latest news?

We would love to hear from you! Please fill in your details and we will stay in touch. It's that simple!