Although I have also resolved the problem of printing an extra comma after the last element then also the program fails all the test cases

@somesh.ps why are you printing endl while taking input? Also, you have to print β€œEND” after printing all the elements. (so dont get rid of the last comma, print it, and after that print END)