Description

Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.

Examples

Input:s = "anagram", t = "nagaram"
Output:true
Explanation:

Both strings contain the same characters.

Input:s = "rat", t = "car"
Output:false
Explanation:

Different characters in the strings.

Input:s = "listen", t = "silent"
Output:true
Explanation:

Both strings contain the same letters: e, i, l, n, s, t.

Constraints

  • 1 ≤ s.length, t.length ≤ 5 × 10⁴
  • s and t consist of lowercase English letters.

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!