String Anagram

Languages

Given two strings str1 and str2, determine if str2 is an anagram of str1 and return true if it is, and false otherwise.

An anagram is a word or phrase formed by rearranging the letters of another word or phrase, using all the original letters exactly once. For example, the words listen and silent are anagrams because they use the same letters with the same frequency, but in a different order.

Input

  • str1: A string
  • str2: A string

Examples

Input: str1 = "abcd", str2 = "dcba"
Output: true
Explanation: Both strings contain the same characters with the same frequency in different orders.
Input: str1 = "hello", str2 = "bello"
Output: false
Explanation: The strings do not contain the same characters.
Input: str1 = "listen", str2 = "silent"
Output: true
Explanation: Both strings contain the same characters with the same frequency in different orders.

Constraints

  • 1 <= str1.length, str2.length <= 1000
  • str1 and str2 consist of lowercase English letters only