Skip to content

Instantly share code, notes, and snippets.

@tsu-nera
Created April 26, 2013 17:27
Show Gist options
  • Select an option

  • Save tsu-nera/5468878 to your computer and use it in GitHub Desktop.

Select an option

Save tsu-nera/5468878 to your computer and use it in GitHub Desktop.
TopCoder SRM577 Dev2 250
/* 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