백준/백준-C++
2941번: 크로아티아 알파벳
Beabletoet
2017. 1. 26. 12:07
#include <iostream>
using namespace std;
int main()
{
char a[100]; int num = 0;
cin >> a;
for (int i = 0; i < 100 && a[i] != '\0'; ++i)
{
if (a[i] == 'c')
{
if (a[i + 1] == '=' || a[i + 1] == '-')
++i;
}
else if (a[i] == 'd')
{
if (a[i + 1] == '-')
++i;
else if (a[i + 1] == 'z' && a[i + 2] == '=')
i += 2;
}
else if (a[i] == 'l' && a[i + 1] == 'j')
++i;
else if (a[i] == 'n' && a[i + 1] == 'j')
++i;
else if (a[i] == 's' && a[i + 1] == '=')
++i;
else if (a[i] == 'z' && a[i + 1] == '=')
++i;
++num;
}
cout << num;
}