-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomB_1122.cpp
More file actions
42 lines (35 loc) · 742 Bytes
/
comB_1122.cpp
File metadata and controls
42 lines (35 loc) · 742 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
#include <iostream>
#include <string>
bool solve(std::string_view A, std::string_view B)
{
int A_cnt[100]={0};
int B_cnt[100]={0};
int a, b;
int res=1;
if(A.length()!=B.length()) return 0;
for(int i=0; i<A.length(); i++) {
a=A[i];
b=B[i];
A_cnt[a-65]++;
B_cnt[b-65]++;
}
for(int i=0; i<100; i++) {
if(A_cnt[i]!=B_cnt[i]) res=0;
}
return res;
}
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
int T;
std::cin >> T;
for(int t{0}; t < T; ++t)
{
std::string A, B;
std::cin >> A >> B;
std::cout << std::boolalpha << solve(A, B) << '\n';
}
return 0;
}