copy and paste intput to output and remove redundant spaces