本文共 1521 字,大约阅读时间需要 5 分钟。
In this problem you are given two names, you have to find whether one name is hidden into another. The restrictions are:
And if two names match exactly, then you can say that one name is hidden into another.
Input
Input starts with an integer T (≤ 100), denoting the number of test cases.Each case starts with two lines. Each line contains a name consists of upper/lower case English letters and spaces. You can assume that the length of any name is between 1 and 100 (inclusive).
Output
For each case, print the case number and “Yes” if one name is hidden into another. Otherwise print “No”.Sample Input
3 Tom Marvolo Riddle I am Lord Voldemort I am not Harry Potter Hi Pretty Roar to man Harry and Voldemort Tom and Jerry and Harry Output for Sample Input Case 1: Yes Case 2: Yes Case 3: No主要是题意看了好久才懂。。。。
其实就是求两串字符串的字母是否一样,部分大小写#include#include #include #include #include #include #include #include #include #define INF 0x3f3f3f3f#define MAXN 2005#define Mod 10001using namespace std;char a[MAXN],b[MAXN];int aa[MAXN],bb[MAXN];bool check(char &a){ if(a>='a'&&a<='z') { a-=32; return true; } if(a>='A'&&a<='Z') return true; return false;}int main(){ int t,cnt=1; scanf("%d",&t); getchar(); while(t--) { gets(a); gets(b); memset(aa,0,sizeof(aa)); memset(bb,0,sizeof(bb)); int lena=strlen(a),lenb=strlen(b); for(int i=0; i
转载地址:http://vpcvb.baihongyu.com/