#include #define FNM 5 /* number of fields */ #define F1 4 /* length of the first field */ #define FS "|" /* field saperator */ main() { int c,i,len,count; int flen[FNM-2]; flen[0]=45; /*length of second field */ flen[1]=40; /* length of third field */ flen[2]=40; /* length of FNM-1 field ; length of last field not reqd */ count=0; i=0; len=F1; c=getchar(); while (c != EOF){ putchar(c); count=count+1; c=getchar(); if (count==len){ printf("%s",FS); len=len+flen[i]; i=i+1; } if (c=='\n'){ count=0; i=0; len=F1; putchar(c); c=getchar(); } } }