code that writes out output; image of sample testcase given in problem statement
adding header.h update