Skip to content

Instantly share code, notes, and snippets.

@agr-shrn
Created September 3, 2015 18:15
Show Gist options
  • Save agr-shrn/c4fc64389bd26726e574 to your computer and use it in GitHub Desktop.
Save agr-shrn/c4fc64389bd26726e574 to your computer and use it in GitHub Desktop.
#include<iostream>
#include<stdio.h>
using namespace std;
bool isAnagram1 ( string s , string t )
{
if ( s == "" || t == "" )
return false;
if ((s . length ()) != (t . length ()))
return false ;
sort( & s [ 0 ], & s [ 0 ] + s . length ());
sort( & t [ 0 ], & t [ 0 ] + t . length ());
if ( s == t )
return true ;
else
return false ;
}
int main()
{
string s,t;
bool a;
cin>>s;
fflush(stdin);
cin>>t;
a = isAnagram1(s,t);
cout<<a;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment