test for nonempty input files
while(flag == 0)