There is more than one correct answer. Here is one approach.
%{
#include <stdio.h>
%}
%%
frog {printf("toad");
}
"\n" {printf("\n");
}
. {printf("%c", yytext[0]);
}
%%
int main()
{
yyin = stdin;
while(yylex() != 0) {}
return 0;
}
int yywrap()
{
return 1;
}