// code challenge
Count ERROR lines
~12 min
Scan a log stream and report how many lines contain ERROR.
You're on call and someone asks "how bad is it?" Quantify it.
Input: the first line is an integer **N**; the next N lines are log lines. Output: print the number of lines that contain the substring `ERROR`.
Example input: ``` 4 10:00 INFO boot 10:01 ERROR db timeout 10:02 WARN slow query 10:03 ERROR db timeout ``` Expected output: ``` 2 ```
Hint: read N with `int(input())`, loop `range(n)`, use `"ERROR" in line`.
Language: python · Judge0
// sample tests
stdin"4\n10:00 INFO boot\n10:01 ERROR db timeout\n10:02 WARN slow query\n10:03 ERROR db timeout" →stdout"2"stdin"2\nINFO ok\nWARN meh" →stdout"0"
Sign in to run and submit.