Code:
import java .io.*;
public class indranil
{
public static void main(String args [])throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
int a,i,l,z;
System.out.println("enter a number a");
a=Integer.parseInt(in.readLine());
l=a.length();
for(i=0;i<l;i++)
{
char ch=a.charAt(i);
if (ch=='')
{
z=z+1;
}
}
System.out.println("the number of spaces in sentence is"+z);
}
}