Anagram: An anagram is a word or sentence, which usually contains all the original letters exactly once, in order to arrange the letters of a different term or phrase. Some of the examples are given below:
1. evil = vile
2. a gentleman = elegant man
3. eleven plus two = twelve plus one
Example 1: Using in-built functions.
Example 2: Without using inbuilt functions.