changes made to head&tail prgm to handle inputs