예전에는 운영체제에서 크로아티아 알파벳을 입력할 수가 없었다. 따라서, 다음과 같이 크로아티아 알파벳을 변경해서 입력했다.
예를 들어, ljes=njak은 크로아티아 알파벳 6개(lj, e, š, nj, a, k)로 이루어져 있다. 단어가 주어졌을 때, 몇 개의 크로아티아 알파벳으로 이루어져 있는지 출력한다.
dž는 무조건 하나의 알파벳으로 쓰이고, d와 ž가 분리된 것으로 보지 않는다. lj와 nj도 마찬가지이다. 위 목록에 없는 알파벳은 한 글자씩 센다.
#include<stdio.h>
#include<string.h>
int main(){
char str[100];
scanf("%s", str);
int i = 0;
int len;
int num = 0;
len = strlen(str);
while(str[i]){
if(str[i] == 'c'){
if(str[i+1]=='=')
num++;
if(str[i+1]=='-')
num++;
}
if(str[i] == 'd'){
//예외 세글자짜리!!
if(str[i+1]=='z' && str[i+2] == '=')
num+=1;
if(str[i+1]=='-')
num++;
}
if(str[i] == 'l'){
if(str[i+1]=='j')
num++;
}
if(str[i] == 'n'){
if(str[i+1]=='j')
num++;
}
if(str[i] == 's'){
if(str[i+1]=='=')
num++;
}
if(str[i] == 'z'){
if(str[i+1]=='=')
num++;
}
i++;
}
len = len-num;
printf("%d", len);
return 0;
}