Problema
Ver traduçãoTwo 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.
Restrições
0 ≤ length of each ≤ 10,000 (ASCII)
Exemplos
Exemplo 1
Entrada:
first = "Listen"
second = "Silent"
Saída esperada:
expected = True
Entrada:
std::string first = "Listen";
std::string second = "Silent";
Saída esperada:
bool expected = true;
Entrada:
string first = "Listen";
string second = "Silent";
Saída esperada:
bool expected = true;
Explicação
Both use e, i, l, n, s, t once each.
Exemplo 2
Entrada:
first = "apple"
second = "paddle"
Saída esperada:
expected = False
Entrada:
std::string first = "apple";
std::string second = "paddle";
Saída esperada:
bool expected = false;
Entrada:
string first = "apple";
string second = "paddle";
Saída esperada:
bool expected = false;
Explicação
The letters and counts differ.
Referências
Este desafio foi adaptado para o CodeUtility. Siga o enunciado e as restrições acima.