Easy 0 solved 0% acceptance

Anagram Check

Check whether two phrases use the same letters.

Problem

Two 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.

Constraints

0 ≤ length of each ≤ 10,000 (ASCII)

Examples

Example 1
Input:
first = "Listen"
second = "Silent"

Expected output:
expected = True
Input:
std::string first = "Listen";
std::string second = "Silent";

Expected output:
bool expected = true;
Input:
string first = "Listen";
string second = "Silent";

Expected output:
bool expected = true;

Explanation

Both use e, i, l, n, s, t once each.

Example 2
Input:
first = "apple"
second = "paddle"

Expected output:
expected = False
Input:
std::string first = "apple";
std::string second = "paddle";

Expected output:
bool expected = false;
Input:
string first = "apple";
string second = "paddle";

Expected output:
bool expected = false;

Explanation

The letters and counts differ.

References

This challenge is adapted for CodeUtility. Follow the statement and constraints above.

Learn from others

Community solutions

No published solutions yet. Solve this challenge to share the first one.