topcode SRM 577 DIV2 EllysNewNickname

#include <iostream>
#include <vector>
#include <string>

using namespace std;

const string vowels = "aeiouy";

bool  isVowels(char ch){
	for(int i = 0; i <  vowels.length(); i ++ )
		if( vowels[i] == ch) return true;
	return false;
}

class EllysNewNickname{
public:
	int getLength(string nickname){
		int cnt = 1;
		for(int i = 1; i < nickname.length(); i ++ ){
			if( isVowels(nickname[i]) && isVowels(nickname[i-1]) ) continue;
			cnt++;
		}
		return cnt;
	}
};

  

posted @ 2013-04-28 19:00  OpenSoucre  阅读(148)  评论(0编辑  收藏  举报