Đề bài
Xem bản dịchTwo 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.
Ràng buộc
0 ≤ length of each ≤ 10,000 (ASCII)
Ví dụ
Đầu vào:
first = "Listen"
second = "Silent"
Kết quả mong đợi:
expected = True
Đầu vào:
std::string first = "Listen";
std::string second = "Silent";
Kết quả mong đợi:
bool expected = true;
Đầu vào:
string first = "Listen";
string second = "Silent";
Kết quả mong đợi:
bool expected = true;
Giải thích
Both use e, i, l, n, s, t once each.
Đầu vào:
first = "apple"
second = "paddle"
Kết quả mong đợi:
expected = False
Đầu vào:
std::string first = "apple";
std::string second = "paddle";
Kết quả mong đợi:
bool expected = false;
Đầu vào:
string first = "apple";
string second = "paddle";
Kết quả mong đợi:
bool expected = false;
Giải thích
The letters and counts differ.
Tham khảo
Thử thách này đã được điều chỉnh cho CodeUtility. Hãy làm theo đề bài và các ràng buộc ở trên.