Problema
Mostra originale (inglese)Due frasi sono anagrammi se contengono esattamente le stesse lettere, lo stesso numero di volte, ignorando maiuscole/minuscole, spazi e punteggiatura.
Implementa is_anagram(first, second).
Input
first: La prima frase. second: La seconda frase.
Output
Restituisci true se le frasi sono anagrammi.
Vincoli
0 ≤ lunghezza di ciascuna ≤ 10.000 (ASCII)
Esempi
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
Entrambe usano e, i, l, n, s, t una volta ciascuna.
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
Le lettere e le rispettive quantità sono diverse.
Riferimenti
Questa sfida è adattata per CodeUtility. Segui la traccia e i vincoli sopra.