#include<bits/stdc++.h>
using namespace std;
int main()
{
string a,b;
cout<<"enter the first string\n";
cin>>a;
cout<<"enter the second string\n";
cin>>b;
if(a.length()==b.length()){
string c=a+a;
if(c.find(b)){
cout<<"Yes , both strings are rotation of each other\n";
}
}
else{
cout<<"No, both strings are not the rotation of each other\n";
}
return 0;
}
using namespace std;
int main()
{
string a,b;
cout<<"enter the first string\n";
cin>>a;
cout<<"enter the second string\n";
cin>>b;
if(a.length()==b.length()){
string c=a+a;
if(c.find(b)){
cout<<"Yes , both strings are rotation of each other\n";
}
}
else{
cout<<"No, both strings are not the rotation of each other\n";
}
return 0;
}
No comments:
Post a Comment