Problème
Afficher la traductionTwo 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.
Contraintes
0 ≤ length of each ≤ 10,000 (ASCII)
Exemples
Exemple 1
Entrée :
first = "Listen"
second = "Silent"
Sortie attendue :
expected = True
Entrée :
std::string first = "Listen";
std::string second = "Silent";
Sortie attendue :
bool expected = true;
Entrée :
string first = "Listen";
string second = "Silent";
Sortie attendue :
bool expected = true;
Explication
Both use e, i, l, n, s, t once each.
Exemple 2
Entrée :
first = "apple"
second = "paddle"
Sortie attendue :
expected = False
Entrée :
std::string first = "apple";
std::string second = "paddle";
Sortie attendue :
bool expected = false;
Entrée :
string first = "apple";
string second = "paddle";
Sortie attendue :
bool expected = false;
Explication
The letters and counts differ.
Références
Ce défi a été adapté pour CodeUtility. Suivez l'énoncé et les contraintes ci-dessus.