Not optimal. Output is as expected from sample I/O.