-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLapindromes.cpp
More file actions
45 lines (30 loc) · 816 Bytes
/
Lapindromes.cpp
File metadata and controls
45 lines (30 loc) · 816 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
#include <bits/stdc++.h>
int main () {
int T;
std::cin >> T;
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
while (T--) {
std::string str;
std::getline(std::cin, str);
int size = str.size();
std::string first_str;
std::string second_str;
int it = size / 2;
for(int i = 0; i < it; i++)
first_str += str[i];
if (size % 2)
it++;
for(int i = it; i < size; i++)
second_str += str[i];
sort(first_str.begin(), first_str.end());
sort(second_str.begin(), second_str.end());
// //debug output
// std::cout << first_str << std::endl;
// std::cout << second_str << std::endl;
// //debug output
if (first_str == second_str)
std::cout << "YES\n";
else
std::cout << "NO\n";
}
}