B-Cool words

Source: Internet
Author: User

B-Cool wordsTime limit:1000MS Memory Limit:131072KB 64bit IO Format:%lld &%llu CSU 1505

Description

Enter some words that consist only of lowercase letters. Your task is to count how many words are "cool", that is, each letter appears in a different number of times.
Ada is cool, for example, because a appears 2 times, D appears 1 times, and 1 and 2 are different. For example, banana is also cool, because a appears 3 times, N appears 2 times, B appears 1 times. However, BBACCCD is not cool because A and d appear the same number of times (both are 1).

Input

The input contains no more than 30 sets of data. Number of first behavior words n (1<=n<=10000) for each set of data. The following n lines contain a single word, with the number of letters 1~30.

Output

For each set of data, output the number of test points and the number of cool words.

Sample Input

2adabbacccd2illnessa

Sample Output

Case 1:1case 2:0

Simple topic, but pay attention to AAA is not "cool"
1#include <stdio.h>2#include <string.h>3 4 Charstr[ +];5 intch[ -];//Number of letters6 BOOLtimes[ +];//the number of letters7 8 intMain ()9 {Ten     intI,n,case=0; One      while(SCANF ("%d", &n)! =EOF) A     { -         intans=0; -          while(n--) the         { -scanf"%s", str); -memset (CH,0,sizeof(CH)); -             intlen=strlen (str); +  -              for(i=0; i<len;i++)//Count +ch[str[i]-'a']++; A  atMemset (Times,0,sizeof(Times)); -             intok=1; -             intnum=0; -              for(i=0;i< -; i++) -             { -                 if(ch[i]!=0) num++; in                 if(ch[i]!=0&& times[ch[i]]==0) -times[ch[i]]=1; to                 Else if(ch[i]!=0&& times[ch[i]]==1)//as long as there is the same number of letters +                 { -ok=0; the                      Break; *                 } $             }Panax Notoginseng             if(ok&&num!=1) -ans++; the         } +printf"Case %d:%d\n",++Case,ans); A     } the     return 0; +}
View Code

B-Cool words

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.