#include <string>
#include <vector>
using namespace std;
int solution(vector<string> babbling) {
int answer = 0;
for(string& str : babbling)
{
int idx=0;
while(true)
{
bool isbreak = false;
switch(str[idx])
{
case 'a' :
if(str[idx+1] == 'y'&& str[idx+2]=='a') idx+=3;
else isbreak = true;
break;
case 'y':
if(str[idx+1] == 'e') idx+=2;
else isbreak = true;
break;
case 'w':
if(str[idx+1]=='o'&& str[idx+2]=='o') idx+=3;
else isbreak = true;
break;
case 'm':
if(str[idx+1]=='a') idx+=2;
else isbreak = true;
break;
default:
isbreak=true;
break;
}
if(isbreak)
break;
}
if(idx == str.size())
answer++;
}
return answer;
}
댓글남기기