public static void main(String[] args){ Scanner sc = new Scanner(System.in); String s = sc.nextLine(); while (s!=null||!s.isEmpty()) { s = sc.nextLine(); } }