백준
[2941] 크로아티아 알파벳
by Jcoder
2018. 7. 14.
#include <iostream>
#include <string>
using namespace std;
int chk(string s);
int main(void)
{
string str;
cin >> str;
cout << chk(str) << endl;
return 0;
}
int chk(string s)
{
int cnt=0;
for (int i = 0; i < s.length(); i++)
{
if (s[i] == 'c')
{
if (s[i + 1] == '=' || s[i + 1] == '-')
i++;
}
else if (s[i] == 'd')
{
if (s[i + 1] == 'z' && s[i + 2] == '=')
{
i++;
i++;
}
else if (s[i + 1] == '-')
i++;
}
else if (s[i] == 'l' && s[i + 1] == 'j')
{
i++;
}
else if (s[i] == 'n' && s[i + 1] == 'j')
{
i++;
}
else if (s[i] == 's' && s[i + 1] == '=')
{
i++;
}
else if (s[i] == 'z' && s[i + 1] == '=')
{
i++;
}
cnt++;
}
return cnt;
}