Character Types

Lab Python Beginner 10 points

Read a line and print how many letters, digits and spaces it contains, as letters=L digits=D spaces=S.

Input

One line.

Output

One line in the format shown.

Example

Input

Hello World 2026

Output

letters=10 digits=4 spaces=2
Sample input available Sample output available
Editor
Python

Hints

Loop over the string one character at a time.

Use ch.isalpha() and ch.isdigit().

Solution explanation

Strings are iterable. isalpha, isdigit, isspace, isupper and friends classify characters.

Show solution
s = input()
letters = digits = spaces = 0
for ch in s:
    if ch.isalpha():
        letters += 1
    elif ch.isdigit():
        digits += 1
    elif ch == " ":
        spaces += 1
print(f"letters={letters} digits={digits} spaces={spaces}")
Output
Answer
HOME LEARN COMMUNITY DASHBOARD