-
Notifications
You must be signed in to change notification settings - Fork 0
/
CCMock1prob2.py
44 lines (41 loc) · 938 Bytes
/
CCMock1prob2.py
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
t = int(input())
for _ in range(t):
s = input()
size = s.__len__()
dict1 = {}
dict2 = {}
if size%2==0:
for i in s[:size//2]:
if i in dict1:
dict1[i]+=1
else:
dict1[i]=1
for i in s[size//2:]:
if i in dict2:
dict2[i]+=1
else:
dict2[i]=1
else:
for i in s[:size//2]:
if i in dict1:
dict1[i]+=1
else:
dict1[i]=1
for i in s[size//2+1:]:
if i in dict2:
dict2[i]+=1
else:
dict2[i]=1
flag = 0
for i in set(s[:size//2]):
if i in dict1 and i in dict2:
if dict1[i]!=dict2[i]:
flag=1
break
else:
flag=1
break
if flag==1:
print('NO')
else:
print('YES')