I was trying to do this exercise. First I wanted to convert string to table with chars. But here I have to stop because toCharArray () function delete all the spaces in the front of line. How to cope with that?
package pl.codegym.task.task08.task0823;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Ruszamy na cały kraj
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String s = reader.readLine();
String newS = "";
char[] literki = s.toCharArray();
for(int i=0;i<literki.length;i++){
System.out.println(literki[i]);
}
System.out.println(newS);
//tutaj wpisz swój kod
}
}