For this Question: Given a string s, Find total number of characters excluding spaces.First line of the input contains the string s.

<b>Constraints</b>
1 <= s. size() <= 10<sup>5</sup>Print number of characters excluding spaceSample Input 1:
newton School

Sample Output 1:
12, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
    public static void main (String[] args) {

                      Scanner sc = new Scanner(System.in);
                      String s = sc.nextLine();
                      int l =s.length();
                      int count = 0;
                      for(int i=0;i<l;i++){
                          if(s.charAt(i)==' ')
                          count++ ;
                      }

                      System.out.print(l-count);
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?