An anagram is formed when two strings contain the same characters with the same frequency, but the arrangement of characters may be different.
Example 1:
Input: s = "anagram", t = "nagaram"
Output: true
Explanation: Both strings contain the same characters with identical frequencies.
Example 2:
Input: s = "rat", t = "car"
Output: false
Explanation: The characters in both strings are different, so they are not anagrams.
Example 3:
Input: s = "listen", t = "silent"
Output: true
Explanation: Both strings contain the same characters arranged in different order.