Rohyoohyun / C

0 stars 0 forks source link

2941 크로아티아 알파벳 #33

Open Rohyoohyun opened 3 months ago

Rohyoohyun commented 3 months ago
#include <stdio.h>
#include <string.h>
int main(){
    char word[100];
    int count = 0;

    scanf("%s", word);
    for(int i=0; i<strlen(word); i++){
        count++;
        if(word[i]== '='){
             if(word[i-1] == 'c' || word[i-1] == 's' || word[i-1] == 'z')
                count--;
            if(word[i-1] == 'z' && word[i-2] == 'd')
                count --;
        }

        if(word[i] == '-')
            if (word[i-1] == 'c' || word[i-1] == 'd')
                count--;

        if (word[i] == 'j')
            if (word[i-1] == 'l' || word[i-1] == 'n')
                count--;
    }
    printf("%d", count);

    return 0;
}