Created
April 26, 2013 17:27
-
-
Save tsu-nera/5468878 to your computer and use it in GitHub Desktop.
TopCoder SRM577 Dev2 250
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* TopCoder | |
| * SRM : 577 | |
| * Division : 2 | |
| * Level : 1 | |
| * | |
| * Created on: | |
| * Author: tsu_nera<fox10225fox@gmail.com> | |
| */ | |
| #include <algorithm> | |
| #include <iostream> | |
| #include <map> | |
| #include <numeric> | |
| #include <set> | |
| #include <sstream> | |
| #include <string> | |
| #include <vector> | |
| using namespace std; | |
| #define FOR(i,s,e) for (int i = int(s); i != int(e); i++) | |
| #define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++) | |
| #define ISEQ(c) (c).begin(), (c).end() | |
| class EllysNewNickname { | |
| public: int getLength(string nickname) { | |
| int length = nickname.size(); | |
| for(int i = 0; i < (int)nickname.size() - 1; i++) { | |
| if(isvowels(nickname[i]) && isvowels(nickname[i+1])) { | |
| length--; | |
| } | |
| } | |
| return length; | |
| } | |
| public: bool isvowels(char x) { | |
| switch(x) | |
| { | |
| case 'a' : | |
| case 'e' : | |
| case 'i' : | |
| case 'o' : | |
| case 'u' : | |
| case 'y' : | |
| return true; | |
| break; | |
| default : | |
| return false; | |
| break; | |
| } | |
| return false; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment