Advise: I will recommend you to use input.nextLine() instead of input.next(). If you don't know the difference, you must know it.