Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- bool validAnagram(string s1,string s2)
- {
- if( s1.size()!=s2.size() )
- return false;
- int i,j;
- for(i=0;i<s1.size();i++){
- for(j=0;j<s2.size();j++){
- if( s1[i]==s2[j] )
- break;
- }
- if( j==s2.size() ) break;
- }
- return i==s1.size();
- }
- int main()
- {
- cout << validAnagram("race", "crre") << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment