Description
三个字符串s,s1,s2,从s1或者s2中找s,s1,s2中可能有隐藏字符*可以表示任何字符
Input
多组用例,第一行为用例组数n,之后每三行一组用例,每组用例包括三个字符串s,s1,s2
Output
对于每组用例,如果能够在s1,s2中找到s则输出win,否则输出lose
Sample Input
3
RBY
B*RRB
G*BRY
BGBG
RZ*Y*PGG
AB*Y*BCB
BAPC
BUBCDAPVDAVVDLPF
VLDCUSPGLSGPPVDD
Sample Output
win
win
lose
Solution
简单字符串处理
Code
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
#define max 110
int m,n,N;
char a[max];
char b[2][max];
int main()
{
scanf("%d",&N);
getchar();
while(N--)
{
gets(a);
gets(b[0]);
gets(b[1]);
m=strlen(a);
n=strlen(b[0]);
int j=0;
for(int i=0;i<n&&j<m;i++)
if(b[0][i]=='*'||b[0][i]==a[j]||b[1][i]==a[j])
j++;
if(j==m)
puts("win");
else
puts("lose");
}
return 0;
}