Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

is anagram c++

#include <iostream>
using std::cout, std::endl, std::string;
#include <algorithm>
using std::is_permutation;

bool isAnagram(const string& firstWord, const string& secondWord){
  if(firstWord.length()!=secondWord.length()){
    return false; 
  }
  return is_permutation(firstWord.begin(), firstWord.end(), secondWord.begin());
}
int main()
{
    isAnagram("apprp","adppp") ? cout<<"is Anagram"<<endl: cout<<"NOT Anagram"<<endl; 
    return 0;
}
 
PREVIOUS NEXT
Tagged: #anagram
ADD COMMENT
Topic
Name
7+7 =