栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

PAT A1084

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

PAT A1084

1084 Broken Keyboard (20 分)
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.

Now given a string that you are supposed to type, and the string that you actually type out, please list those keys which are for sure worn out.

Input Specification:
Each input file contains one test case. For each case, the 1st line contains the original string, and the 2nd line contains the typed-out string. Each string contains no more than 80 characters which are either English letters [A-Z] (case insensitive), digital numbers [0-9], or _ (representing the space). It is guaranteed that both strings are non-empty.

Output Specification:
For each test case, print in one line the keys that are worn out, in the order of being detected. The English letters must be capitalized. Each worn out key must be printed once only. It is guaranteed that there is at least one worn out key.

Sample Input:
7_This_is_a_test
_hs_s_a_es
Sample Output:
7TI

#include
#include
#include
using namespace std;
int main()
{
	map count;
	char temps1[90],temps2[90];
	scanf("%s",temps1);
	scanf("%s",temps2);
	int l1=strlen(temps1);
	int l2=strlen(temps2);
//	printf("%d %dn",l1,l2);
	for(int i=0;i='a'&&temps2[i]<='z')
		temps2[i]-=32;
		if(count.count(temps2[i])==0)
		{
			//printf("%c n",temps1[i]);
			count[temps2[i]]=0;
		}
		//printf("%c n",temps1[i]);
		count[temps2[i]]++;
	}
	for(int i=0;i='a'&&temps1[i]<='z')
		temps1[i]-=32;
		if(count.count(temps1[i])==0)
		{
			count[temps1[i]]=0;
			printf("%c",temps1[i]);
			
		}
	}
	
	return 0;
}```


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/722970.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号