Problema
Mostra traduzioneTwo 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.
Vincoli
0 ≤ length of each ≤ 10,000 (ASCII)
Esempi
Esempio 1
Input:
first = "Listen"
second = "Silent"
Output atteso:
expected = True
Input:
std::string first = "Listen";
std::string second = "Silent";
Output atteso:
bool expected = true;
Input:
string first = "Listen";
string second = "Silent";
Output atteso:
bool expected = true;
Spiegazione
Both use e, i, l, n, s, t once each.
Esempio 2
Input:
first = "apple"
second = "paddle"
Output atteso:
expected = False
Input:
std::string first = "apple";
std::string second = "paddle";
Output atteso:
bool expected = false;
Input:
string first = "apple";
string second = "paddle";
Output atteso:
bool expected = false;
Spiegazione
The letters and counts differ.
Riferimenti
Questa sfida è adattata per CodeUtility. Segui la traccia e i vincoli sopra.