Q15. Write a code to check whether the two strings are anagram of each other or not.

Anagram :- When two strings contain the same characters irrespective of the order of occurrence then such strings are known as Anagram.
For Example :-
String1 = eleven plus two
String2 = twelve plus one
So as we can see that both strings have same characters, only the order of characters is different so this is an Anagram

Algorithm for Anagram

START
Step->1 : Define two strings.
Step->2 : Check for their lengths. If the lengths are not equal, then strings are not an anagram.
Step->3 : Else, convert the string to lower case character to make the comparison easy.
Step->4 : Some language allows the strings to provide inbuilt function for sorting of string. If not then convert them to character array for sorting.
Step->5 : Sort the array.
Step->6 : Finally, check for the equality of content.
STOP

Code for Anagram

Output

The two strings are anagram of each other

Recommended Programs
Program to find factorial of a number
Program to count number of digits in a number