LearnPy Hub
← Context Managers problems
Hard

Optional Context

Read log or quiet, then a line of words. If log, wrap the work in a context manager that prints start/stop; if quiet, use contextlib.nullcontext(). The work prints the number of words.

Input

Mode, then a line.

Output

Lines.

Sample 1

Input
log
a b c
Output
start
3
stop

Sample 2

Input
quiet
a b c
Output
3
solution.py
Output appears here
Optional Context · Python practice problem · LearnPy Hub