ZOJ 3603 Draw Something Cheat

来源:互联网 发布:破解版360企业云盘mac 编辑:程序博客网 时间:2024/05/17 22:23



    Draw Something Cheat


Have you played Draw Something? It's currently one of the hottest social drawing games on Apple iOS and Android Devices! In this game, you and your friend play in turn. You need to pick a word and draw a picture for this word. Then your friend will be asked what the word is, given the picture you have drawn. The following figure illustrates a typical scenario in guessing the word.

word guessing in draw something

As you see, when guessing a word you will be given the picture and 12 letters. You must pick some of these letters to form a word that matches the picture. Each letter can only be used once. It is a lot of fun if your friend is a talented painter, but unfortunately some drawings from your friend are totally incomprehensible. After several times of becoming mad by the drawings, you find a way to cheat in the game.

In this game, letters not included in the correct answer are randomly generated. If you cannot find the correct answer when guessing, you can write down all the letters and restart the game. Then you would find some of these letters are changed. Of course these changed letters will never appear in the answer. By eliminating these letters you are a step closer to the answer.

So In this problem, you need to write a program to automate the cheating process. Given N strings of letters to the same picture, you need to eliminate as many letters as possible, and output the remaining letters.

Input

There are multiple test cases. The first line of the input is an integer T ≈ 1000 indicating the number of test cases.

Each test case begins with a positive integer N ≤ 20 indicating the number of times you have entered the game. Then N lines follow. Each line is a string of exactly 12 uppercase letters, indicating the candidate letters in one guess. It is guaranteed that the answer has at least 1 letter and has no more than 12 letters.

Output

For each test case, output the remaining letters in alphabet order after the process described above. One line for each test case.

Sample Input

22ABCDEFGHIJKLABCDEFGHIJKL2SAWBCVUXDTPNZQTLFJYRCGAK

Sample Output

ABCDEFGHIJKLACT



a,用来存储答案,

b,用来存储当前字符出现的频率;

多个字符可出现多次




#include<iostream>#include<stdio.h>  #include<string.h>  #include<stdlib.h>  using namespace std;char str[1000];int main(){int N;cin>>N;while(N--){int n,i,j,b[26];int a[26];cin>>n;cin>>str;int len=strlen(str);memset(a,0,sizeof(a));for(i=0;i<len;i++){a[str[i]-'A']++;}for(int k=1;k<n;k++){cin>>str;len=strlen(str);memset(b,0,sizeof(b));for(i=0;i<len;i++){b[str[i]-'A']++;}for(i=0;i<26;i++)a[i]=min(a[i],b[i]);//这里更新答案}for(i=0;i<26;i++)while(a[i]--)printf("%c",i+'A');cout<<endl;}}


0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 宇飞来手机死机怎么办 宇飞来忘记密码怎么办 手机总卡死机怎么办 手机经常死机怎么办啊 手机卡到动不了怎么办 三星手机卡住了怎么办 手机突然动不了怎么办 苹果手机密码锁死了怎么办 节目指南无响应怎么办 电信卡网速不好怎么办 网上有人黑我怎么办? 公司前台没事做怎么办 股票跌到谷底了怎么办 cad无法进一步缩小怎么办 dnf更新错误280怎么办 win7电脑屏幕倒过来了怎么办 电脑画面缩小了怎么办 每次客户不付款怎么办 如果客户不付款怎么办 支付宝逾期起诉怎么办 卖号被骗了怎么办 网上交易视频被骗了怎么办 闲鱼卖游戏账号被骗怎么办 网银锁住了怎么办 电脑密码锁住了怎么办 苹果x旋转不了怎么办 苹果x黑白屏怎么办 dell网卡坏了怎么办 笔记本连网速慢怎么办 无线充电太慢怎么办 vivo手机速度慢怎么办 台式电脑很卡怎么办 电脑网卡驱动程序不正常怎么办 电脑没有网卡驱动怎么办 电脑网络网速差怎么办 小米wifi测速慢怎么办 电脑网速特别慢怎么办 戴尔电脑网速慢怎么办 电脑网络特别慢怎么办? 电脑上网很慢怎么办 笔记本网速太慢怎么办