LearnPy Hub
← Regular Expressions problems
Medium

Parse Log Lines

Each line looks like 2026-10-28 ERROR disk full. Using named groups, count lines per level (INFO, WARN, ERROR) until END and print the counts in that order.

Input

Lines, then END.

Output

Three lines.

Sample 1

Input
2026-10-28 ERROR disk full
2026-10-28 INFO ok
END
Output
INFO 1
WARN 0
ERROR 1

Sample 2

Input
END
Output
INFO 0
WARN 0
ERROR 0
solution.py
Output appears here
Parse Log Lines · Python practice problem · LearnPy Hub