C Programming Code Examples C > Beginners Lab Assignments Code Examples Program to copy its input to its output replacing string of one Program to copy its input to its output replacing string of one or more blanks by a single blank #include <stdio.h> #include <conio.h> void main() { char c; clrscr(); printf(" Enter a line of text:- "); printf(" String will be terminated if you press ENTER."); printf(" Press Ctrl-Z & then ENTER to end the task."); printf(" STRING:- "); c=getchar(); printf(" Justified form:- "); while (c!=EOF) { if (c==' ') putchar(c); while (c==' ') { c=getchar(); } putchar(c); c=getchar(); } getch(); }