-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6996.cpp
More file actions
38 lines (36 loc) · 747 Bytes
/
6996.cpp
File metadata and controls
38 lines (36 loc) · 747 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
// 6996. 애너그램
// 2021.03.31
// 구현, 문자열, 정렬
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
int t;
cin >> t;
string a;
string b;
string tmpA;
string tmpB;
while (t-- > 0)
{
a.clear();
b.clear();
cin >> a >> b;
tmpA = a;
tmpB = b;
// 둘이 정렬해서 같은지 비교해보면 된다.
sort(tmpA.begin(), tmpA.end());
sort(tmpB.begin(), tmpB.end());
if (tmpA == tmpB)
{
cout << a << " & " << b << " are anagrams." << endl;
}
else
{
cout << a << " & " << b << " are NOT anagrams." << endl;
}
}
return 0;
}