백준
[1316] 그룹 단어 체커
by Jcoder
2018. 7. 14.
#include <iostream>
#include <string>
using namespace std;
bool sol(string check);
int main()
{
int num;
int cnt = 0;
cin >> num;
for (int i = 0; i < num; i++)
{
string str;
cin >> str;
if (sol(str))
{
cnt++;
}
}
cout << cnt << endl;
return 0;
}
bool sol(string check)
{
bool alp[26] = { false, };
for (int i = 0; i < check.length(); i++)
{
if (alp[check[i] - 'a'])
return false;
else
{
alp[check[i] - 'a'] = true;
char temp = check[i];
while (1)
{
if (temp != check[++i])
{
i--;
break;
}
}
}
}
return true;
}