#include <string>
#include <vector>
#include <iostream>
using namespace std;
int solution(vector<string> babbling) {
int answer = 0;
for (string &babble : babbling)
{
int check = 1;
for (int i = 0; i < babble.size(); i++)
{
if (babble.substr(i, 3) == "aya") i+=2;
else if (babble.substr(i, 2) == "ye") i+=1;
else if (babble.substr(i, 3) == "woo") i+=2;
else if (babble.substr(i, 2) == "ma") i+=1;
else
{
check = 0;
break;
}
}
if (check == 1) answer++;
}
return answer;
}
참고: https://velog.io/@krydyh/프로그래머스-C-옹알이-1