[문제 링크] : https://www.acmicpc.net/problem/6996
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int T;
string a, b, tmp1, tmp2;
cin >> T;
for(int i=0; i<T; i++){
cin >> a >> b;
tmp1 = a, tmp2 = b;
sort(a.begin(), a.end());
sort(b.begin(), b.end());
if(a == b){
cout << tmp1 << " & " << tmp2 << " are anagrams.\n";
}
else{
cout << tmp1 << " & " << tmp2 << " are NOT anagrams.\n";
}
}
return 0;
}
'알고리즘' 카테고리의 다른 글
[알고리즘] 백준 26082 - WARBOY (C++) (0) | 2024.10.25 |
---|---|
[알고리즘] 백준 19698 - 헛간 청약 (C++) (0) | 2024.10.24 |
[알고리즘] 백준 4562 - No Brainer (C++) (0) | 2024.10.22 |
[알고리즘] 백준 2526 - 싸이클 (C++) (0) | 2024.10.21 |
[알고리즘] 백준 14935 - FA (C++) (0) | 2024.10.20 |