-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathequivalent-strings2.cpp
More file actions
executable file
·59 lines (57 loc) · 1010 Bytes
/
equivalent-strings2.cpp
File metadata and controls
executable file
·59 lines (57 loc) · 1010 Bytes
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
53
54
55
56
57
58
59
/*
* =====================================================================================
*
* Filename: equivalent-strings2.cpp
*
* Description:
*
* Version: 1.0
* Created: Sunday 22 March 2015 12:17:43 IST
* Revision: none
* Compiler: gcc
*
* Author: Shounak Dey (), dylandey1996@gmail.com
* Organization:
*
* =====================================================================================
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
int T;
cin >> T;
while(T--)
{
string a,b;
cin >> a >> b;
int q;
cin >> q;
while(q--)
{
int i,j,k;
cin >> i >> j >> k;
i--;
j--;
int f=0;
for(int p=i;p<(i+k);p++)
{
for(int l=j;l<(j+k);l++)
{
if(!((a[p]==a[l] && b[p-i+j]==b[l-i+j]) && (a[p]!=a[l] && b[p-i+j]!=b[l-i+j])))
{
f=1;
break;
}
}
if(f==1)
break;
}
if(f==0)
cout << "yes\n";
else
cout << "no\n";
}
}
return 0;
}