Medium
Capture Printed Output
Use
contextlib.redirect_stdout with an io.StringIO to capture the output of printing each input word. Then print the captured text in upper case, words joined by spaces.Input
One line of words.
Output
One line.
Sample 1
Input
hello world
Output
HELLO WORLD
Sample 2
Input
x
Output
X
Output appears here