I need to remove all spaces from it.
Eg: This is my code O/P : Thisismycode
This is my code so far.
import java.util.Scanner;
public class nospace{
public static void main(String args[]){
    Scanner s=new Scanner(System.in);
    System.out.println("Enter a String");
    String N=s.nextLine();
    N=N.trim();
    N=N+" ";
    int l=N.length();
    int a=0;
    for(int i=0;i<=l-1;i++){
        if(N.charAt(i)==32){
    System.out.println(N.substring(a,i+1));
    }
    a=i;
    }
}
}
All it does it print the last letters of each word. Any help is appreciated.
 
     
     
     
    