Problem
Übersetzung anzeigenTwo 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.
Einschränkungen
0 ≤ length of each ≤ 10,000 (ASCII)
Beispiele
Eingabe:
first = "Listen"
second = "Silent"
Erwartete Ausgabe:
expected = True
Eingabe:
std::string first = "Listen";
std::string second = "Silent";
Erwartete Ausgabe:
bool expected = true;
Eingabe:
string first = "Listen";
string second = "Silent";
Erwartete Ausgabe:
bool expected = true;
Erläuterung
Both use e, i, l, n, s, t once each.
Eingabe:
first = "apple"
second = "paddle"
Erwartete Ausgabe:
expected = False
Eingabe:
std::string first = "apple";
std::string second = "paddle";
Erwartete Ausgabe:
bool expected = false;
Eingabe:
string first = "apple";
string second = "paddle";
Erwartete Ausgabe:
bool expected = false;
Erläuterung
The letters and counts differ.
Referenzen
Diese Aufgabe wurde für CodeUtility angepasst. Beachte die oben genannten Vorgaben und Einschränkungen.