Problem Link
Solution :-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
/*------------------------------------------------*/ //Uva Problem No: 494 //Problem Name : Kindergarten Counting Game //Type : Ad hoc. //Author : Shipu Ahamed //University : BUBT //E-mail : shipuahamed01@gmail.com /*------------------------------------------------*/ #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<iostream> #include<cctype> #include<map> #include<stack> #include<cstdlib> #include <queue> #include <vector> #include<algorithm> #define ll long long #define sc scanf #define pf printf #define Pi 2*acos(0.0) using namespace std; int main() { int i,c,w; char a[1000]; while(gets(a)) { c=0; w=1; for(i=0;a[i];i++) { if((a[i]>='A'&&a[i]<='Z')||(a[i]>='a'&&a[i]<='z')) { if(w) c++; w=0; } else w=1; } printf("%dn",c); } return 0; } |
2 comments