Условие
Показать переводTwo phrases are anagrams if they contain exactly the same letters the same number of times, ignoring case, spaces and punctuation.
Implement is_anagram(first, second).
Input
first: The first phrase. second: The second phrase.
Output
Return true if the phrases are anagrams.
Ограничения
0 ≤ length of each ≤ 10,000 (ASCII)
Примеры
Пример 1
Ввод:
first = "Listen"
second = "Silent"
Ожидаемый вывод:
expected = True
Ввод:
std::string first = "Listen";
std::string second = "Silent";
Ожидаемый вывод:
bool expected = true;
Ввод:
string first = "Listen";
string second = "Silent";
Ожидаемый вывод:
bool expected = true;
Пояснение
Both use e, i, l, n, s, t once each.
Пример 2
Ввод:
first = "apple"
second = "paddle"
Ожидаемый вывод:
expected = False
Ввод:
std::string first = "apple";
std::string second = "paddle";
Ожидаемый вывод:
bool expected = false;
Ввод:
string first = "apple";
string second = "paddle";
Ожидаемый вывод:
bool expected = false;
Пояснение
The letters and counts differ.
Ссылки
Это задание адаптировано для CodeUtility. Следуйте условию и ограничениям выше.