PAT(甲级)1084. Broken Keyboard (20)

来源:互联网 发布:我的世界优化fps 编辑:程序博客网 时间:2024/05/18 17:59

题目:https://www.patest.cn/contests/pat-a-practise/1084

代码:

#include<cstdio>#include<cstring>#include<cstdlib>#include<algorithm>using namespace std;int main(){bool a[128]={false};char str1[100],str2[100];gets(str1);gets(str2);int len1=strlen(str1);int len2=strlen(str2);for(int i=0;i<len1;i++){    char temp1,temp2;int j;for(j=0;j<len2;j++){   temp1=str1[i];   temp2=str2[j];   if(temp1>='a'&&temp1<='z') temp1-=32;   if(temp2>='a'&&temp2<='z') temp2-=32;   if(temp1==temp2) break;}if(j==len2&&a[temp1]==false){  printf("%c",temp1);  a[temp1]=true;}}system("pause");} 

0 0