Легко Решено: 0 Процент решений: 0%

Pangram Check

A pangram contains every English letter at least once.

Чему вы научитесь

  • Collect the distinct letters of a text
  • Ignore case and non-letters
  • Compare against the 26-letter alphabet

Условие

Показать перевод

A pangram contains every English letter at least once. Determine whether the text is a pangram. Ignore case, spaces, digits, and punctuation.

Implement pangram_check(text).

Input

text: The text to inspect.

Output

Return true if all 26 letters appear, otherwise false.

Ограничения

0 ≤ text length ≤ 100,000. Input contains printable ASCII characters. Only letters A–Z and a–z count.

Примеры

Пример 1
Ввод:
text = "The quick brown fox jumps over the lazy dog."

Ожидаемый вывод:
expected = True
Ввод:
std::string text = "The quick brown fox jumps over the lazy dog.";

Ожидаемый вывод:
bool expected = true;
Ввод:
string text = "The quick brown fox jumps over the lazy dog.";

Ожидаемый вывод:
bool expected = true;

Пояснение

Every letter from a through z appears at least once. Capital T counts as t.

Пример 2
Ввод:
text = "abcdefghijklmnopqrstuvwxy"

Ожидаемый вывод:
expected = False
Ввод:
std::string text = "abcdefghijklmnopqrstuvwxy";

Ожидаемый вывод:
bool expected = false;
Ввод:
string text = "abcdefghijklmnopqrstuvwxy";

Ожидаемый вывод:
bool expected = false;

Пояснение

This text contains a through y, but it has no z. One missing letter makes it false.

Как подступиться

Сначала попробуйте сами, затем открывайте подсказки по одной.

Подсказка 1

Normalize the text so letter case does not matter.

Подсказка 2

Track which of the 26 letters have appeared at least once.

Подсказка 3

Ignore every non-letter character completely, including spaces and punctuation.

Ожидаемая сложность

O(n) time, O(1) extra space

Ссылки

Это задание адаптировано для CodeUtility. Следуйте условию и ограничениям выше.

Учитесь у других

Решения сообщества

Пока нет опубликованных решений. Решите задание, чтобы поделиться первым.