Anagram Definition

An anagram of a word is a word that’s formed by rearranging the letters of the original word. For example: the anagrams of the word for are

  • for
  • fro
  • ofr
  • orf
  • rof
  • rfo

Note that, the anagrams use all the original letters exactly once.

If two strings are anagram to each other, their sorted sequence is the same.

More examples : Anagram & Nagaram are anagrams (case-insensitive). Similarly, abcd and abdc are anagrams, but abcd and abdce is not.