Anagram In Java

 Any word or phrase that exactly reproduces the letters in another order is an anagram.

Example: catact, study – dusty, gainly – laying etc.,

Logic for anagram is below:

  1. Check for same length
  2. Sort the letters in the given word
  3. Compare the sorted words are same

Output: