-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLAPIN.cpp
More file actions
36 lines (34 loc) · 693 Bytes
/
Copy pathLAPIN.cpp
File metadata and controls
36 lines (34 loc) · 693 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
#include <bits/stdc++.h>
using namespace std;
void is_lapin(string left, string right, int half_len){
vector<int> l(26, 0);
vector<int> r(26, 0);
for(int i=0;i<half_len;i++){
l[left[i]-97]++;
r[right[i]-97]++;
}
if (l == r){
cout<<"YES"<<"\n";
}
else{
cout<<"NO"<<"\n";
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--){
string s;
cin>>s;
int len = s.length();
if (len%2){
is_lapin(s.substr(0, len/2), s.substr((len/2) + 1, len/2), len/2);
}
else{
is_lapin(s.substr(0, len/2), s.substr(len/2, len/2), len/2);
}
}
return 0;
}