UVA494:

Kindergarten Counting Game

#include <iostream>
#include <string>

using namespace std;


int main(){
	string s;


	while(getline(cin, s)){
		int counter = 0; 
		bool start = true;

		for(int i = 0; i < s.length(); i++){
			bool isLetter = (s[i] >= 'a' && s[i] <= 'z') ||  (s[i] >= 'A' && s[i] <= 'Z');
			
			if(isLetter){
				if(start){
					counter++;
					start = false;
				} 

			} else {
				start = true;
			}
		}

		cout << counter << endl;

	}

	return 0;

}
[Back to Listing Page]

Home

Posts

Projects

Github

Contact

janzzen

Developed by Janzzen Ang powered by Vercel