#30628: C ans


aaa67168900@gmail.com (陳恩恩)

學校 : 不指定學校
編號 : 173416
來源 : [223.138.212.234]
最後登入時間 :
2022-09-24 17:11:45
e706. 12820 - Cool Word -- UVA | From: [111.252.94.23] | 發表日期 : 2022-06-02 01:20

//Cool Words
//Zero Judge e.706

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<math.h>

int main(){

    int n;
    int a = 0;
    while(scanf("%d", &n) !=EOF){
        char str[10000];
        int cool_word = 0;

        for(int i=0; i<n; i++){
            scanf("%s", str);

            int cnt[10000] = {0};
            int alpha[26] = {0};
            for(int i=0; i<strlen(str); i++){
                alpha[toupper(str[i]) - 'A']++;
            }

            for(int i=0; i<26; i++){
                if(alpha[i] != 0 && (cnt[alpha[i]] == 1 || alpha[i] == strlen(str))){
                    cool_word--;
                    break;
                }

                cnt[alpha[i]] = 1;
            }

            cool_word++;
        }

        a++;
        printf("Case %d: %d\n", a, cool_word);
    }
}
 
ZeroJudge Forum