Same Letters Check

An anagram means you can rearrange the same characters to build another word or string. Given strings s and t, return True if they contain the same characters in the same counts. The order does not matter; only which characters appear and how many times each one appears. If the character counts differ, return False.

Примеры

Ввод
"anagram", "nagaram"
Вывод
True
Ввод
"rat", "car"
Вывод
False
Ввод
"", ""
Вывод
True

Нужно реализовать

def is_anagram(s: str, t: str) -> bool:

Теги

stringshashmapdictsorting
PostgreSQLv16

Ovdje će se prikazati rezultat izvršavanja koda

Visible tests
1
Input
"anagram", "nagaram"
ExpectedTrue
2
Input
"rat", "car"
ExpectedFalse
3
Input
"", ""
ExpectedTrue
4
Input
"a", "ab"
ExpectedFalse
5
Input
"listen", "silent"
ExpectedTrue
6
Input
"listen", "silent!"
ExpectedFalse
Focus radio
Paused · SomaFM · Fluid