s=input()
Q=int(input())
O=[]
for i in range (Q):
A,B,C,D=map(int,input().split())
X=s[A-1:B]
Y=s[C-1:D]
x=26*[0]
y=26*[0]
for j in range(B-A+1):
x[ord(X[j])-97]+=1
y[ord(Y[j])-97]+=1
if x==y: O+=["DA"]
else: O+=["NE"]
for i in range(Q):
print(O[i])
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
316 ms |
3508 KB |
Output is correct |
2 |
Correct |
332 ms |
3608 KB |
Output is correct |
3 |
Correct |
349 ms |
3508 KB |
Output is correct |
4 |
Correct |
430 ms |
3640 KB |
Output is correct |
5 |
Correct |
335 ms |
3508 KB |
Output is correct |
6 |
Execution timed out |
3049 ms |
3752 KB |
Time limit exceeded |
7 |
Execution timed out |
3037 ms |
3940 KB |
Time limit exceeded |
8 |
Execution timed out |
3016 ms |
3812 KB |
Time limit exceeded |
9 |
Execution timed out |
3050 ms |
3812 KB |
Time limit exceeded |
10 |
Execution timed out |
3031 ms |
3860 KB |
Time limit exceeded |