forked from CodeToExpress/dailycodebase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckAnagram.cpp
More file actions
33 lines (27 loc) · 718 Bytes
/
Copy pathcheckAnagram.cpp
File metadata and controls
33 lines (27 loc) · 718 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
/*
* @author : imkaka
* @date : 27/12/2018
*/
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
string str1, str2;
cin >> str1 >> str2;
string temp1 = str1, temp2 = str2;
if(str1.size() != str2.size()){
cout << temp1 << " and " << temp2 << " are NOT Anagrams of each other!!" << endl;
}
else{
sort(str1.begin(), str1.end());
sort(str2.begin(), str2.end());
if(str1 == str2){
cout << temp1 << " and " << temp2 << " are Anagrams of each other!!" << endl;
}
else{
cout << temp1 << " and " << temp2 << " are NOT Anagrams of each other!!" << endl;
}
}
return 0;
}