The tenth session of Hunan Province College students computer Program design competition: Cool words

Source: Internet
Author: User

1505: Cool Words
Time limit:1 Sec Memory limit:128 MB
submit:237 solved:88
[Submit] [Status] [Web Board]
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
2
Ada
Bbacccd
2
Illness
A

Sample Output
Case 1:1
Case 2:0

HINT

Source

The tenth session of Hunan Province College students computer Program design Contest

Provincial game check-in question, mainly a string of some operations, basically did not involve any algorithm, read test instructions can do, the title means that the statistics given the number of words in the word are different words, if the word has only one letter, it is considered the same.

#include <iostream>#include <cstdio>#include <cstring>using namespace STD;intMain () {intn,len,count,flag,k=1;Chars[ +];inta[ -]; while(scanf("%d", &n)!=eof) {count=0; while(n--) {flag=1;memsetA0,sizeof(a));scanf('%s ', s); len=strlen(s); for(intI=0; i<len; i++) {a[s[i]-' A ']++;//Count the number of occurrences of word letters} for(intI=0; i< -; i++) { for(intj=i+1; j< -; J + +) {if(a[i]==a[j]&&a[i]!=0) {flag=0; Break; }                }            }if(flag==1&&len!=1) {count++; }        }printf("Case%d:%d\n", K++,count); }return 0;}

The tenth session of Hunan Province College students computer Program design competition: Cool words

Related Article

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.