change input function to fgets()