Count space, tabs and new lines java

how can i count tabs and new Lines?
I want to store it in s String something like this(my brotherrhast apples)
thank you!

    int space=0,tabs=0,newLines=0;  
    Scanner scanner=new Scanner(System.in);
    scanner.useDelimiter("\rn]");
    System.out.println("Enter one or more lines:");
    String s = scanner.nextLine();
    for(int i=0; i< s.length(); i++){       
           char letter = s.charAt(i);
           if(letter == ' '){
            space++;
           } 
           if(letter == 't'){
               tabs++;
           }
           if(letter == 'r'){
               newLines++;
           }
       }

    System.out.println("The number of blank spaces is = "+ space);
    System.out.println("The number of tabs is = "+ tabs); 
    System.out.println("The number of new lines is = "+ newLines);
}