forked from TusharKukra/CppPrograms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnagrams.cpp
More file actions
40 lines (34 loc) · 646 Bytes
/
Copy pathAnagrams.cpp
File metadata and controls
40 lines (34 loc) · 646 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
#include<iostream>
#include<cstring>
using namespace std;
int main()
{ char str1[20],str2[20];
int i,j,len1,len2,len,flag=0;
cout<<"enter 1st string \n";
cin>>str1;
cout<<"enter 2nd string \n";
cin>>str2;
len1=strlen(str1);
len2=strlen(str2);
if(len1==len2)
{ len=len1;
for(i=0;i<len;i++)
{
for(j=0;j<len;j++)
{
if(str1[i]==str2[j])
{
flag=1;
break;
}
}
if(flag==0)
break;
}if(flag==1)
cout<<"anagrams \n";
else cout<<" length is only same \n";
}
else
cout<<"\n not anagrams";
return 0;
}