-
Notifications
You must be signed in to change notification settings - Fork 0
/
ABBR.cpp
52 lines (49 loc) · 796 Bytes
/
ABBR.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
string s;
cin>>s;
int l = s.length();
string p;
cin>>p;
int lp = p.length();
int flag=0,flag2=0;
for(int i = 0; i < l; i++)
{
int j;
for(j = 0; j < lp && i + j < l; j++)
{
//printf("%c %d\n",s[i+j],j);
if(s[i+j]-p[j]==32 || (s[i+j]==p[j]))
continue;
else if(s[i+j]>='A' && s[i+j]<='Z')
{
flag2 = 1;
break;
}
else if(s[i + j] != p[j])
break;
}
if(j == lp)
{
flag = 1;
printf("YES\n");
break;
}
if(flag2)
{
printf("NO\n");
break;
}
}
if(!flag && !flag2)
{
printf("NO\n");
}
}
}