View Code of Problem 54

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {	
		int x=1;
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		char[] c = s.toCharArray();
		for(char cc:c) {
			if(x==c.length) {
				System.out.print(cc);
			}else {
				System.out.print(cc+" ");
			}
			x++;
		}
		scan.close();
		}
}

Double click to view unformatted code.


Back to problem 54