#include <stdio.h>

int main() {
    int n,cnt=0;
    char str[101];
    //n개의 단어 입력 받음, 반복
    scanf("%d",&n);
    for (int i=0; i<n; i++) {
        //알파벳이 사용되었는지 확인
        int alp_used[26]={0};
        //그룹단어 인지 확인
        int is_group=1;
    
        scanf("%s",str);
        
        int j=0;
        //단어가 끝날때 까지 계속
        while(str[j]) {
            //단어의 알파벳 인덱스 (a=0,b=1 등)
            int current_idx=str[j]-'a';
            //현재 알파벳이랑 다음 알파벳이 다르면 현재알파벳이 사용되었는지 확인
            if (str[j]!=str[j+1]) {
                //알파벳이 사용된적이 있으면 그룹단어가 아님
                if (alp_used[current_idx]==1) {
                    is_group=0;
                    break;
                }
                //현재 알파벳이 사용됨
                alp_used[current_idx]=1;
            }
            j++;
        }
        if (is_group==1) cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: