There is more than one correct answer. Here is one approach.

%{
#include <stdio.h>
%}
%%
[ \t]+	{putchar(' ');
	}

"\n"	{putchar('\n');
	}

. 	{putchar(yytext[0]);
        }
%%

int main()
{
  while(yylex() != 0) {}
  return 0;
}

int yywrap()
{
  return 1;
}