Word not printing in exact line

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc= new Scanner(System.in);
String str= sc.nextLine();
for(int i=0;i<str.length();i++){
if(str.charAt(i)>=ā€˜A’&& str.charAt(i)<=ā€˜Z’){
System.out.println(str.charAt(i));
}
else if(str.charAt(i)>=ā€˜a’&& str.charAt(i)<=ā€˜z’){
System.out.print(str.charAt(i));

			 }
			 
			 } 
			 } 
			 }

@Shivam_balwani,
https://ide.codingblocks.com/s/264345 corrected code.

When you do: System.out.println(str.charAt(i));
It prints the character and then places the cursor in a new line. So instead of that, add a new line first and then print the char as in the code I have attached.