forked from CodeToExpress/dailycodebase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday6_3.cpp
More file actions
43 lines (37 loc) · 725 Bytes
/
Copy pathday6_3.cpp
File metadata and controls
43 lines (37 loc) · 725 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
/*
* @author : dhruv-gupta14
* @date : 27/12/2018
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
int flag=0;
string str1;
getline(cin,str1);
string str2;
getline(cin,str2);
int n = str1.length();
int m = str2.length();
if(n!=m)
{
cout << "Not Anagrams";
} else{
sort(str1.begin(), str1.end());
sort(str2.begin(), str2.end());
for(int i=0; i<n; i++)
{
if(str1[i] != str2[i])
{
cout << "Not Anagrams";
flag = 1;
break;
}
}
if(flag == 0)
{
cout << "Anagrams";
}
}
return 0;
}