uva 494 - Kindergarten Counting Game

All about problems in Volume 4. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
FahimSifnatul
New poster
Posts: 2
Joined: Sat Jun 25, 2016 8:10 am

uva 494 - Kindergarten Counting Game

Post by FahimSifnatul » Sat Jun 25, 2016 8:41 am

i am getting wa . but no problem i have found-----
#include<iostream>
#include<string>
using namespace std;

int main()
{
string s;
long long int count,j,i,flag;
while(!cin.eof() and getline(cin,s))
{
count=0;
flag=0;
for(i=0;i<s.length();i++)
{
if((s>='a' and s<='z') or (s>'A' and s<='Z'))
{
++flag;
}
else
flag=0;
if(flag==1)
{
++count;
}
}

cout<<count<<endl;
}
}

Post Reply

Return to “Volume 4 (400-499)”