Question – 8
import java.util.*;
class loop
{
    public static void main (String args[])
    {
        Scanner sc = new Scanner (System.in);
        String str; 
        char ch, ch1; 
        int c = 0;
        System.out.println("Enter a sentence");
        str = sc.nextLine().toUpperCase();
        int len = str.length();
        for (int i=0; i < len-1;i++)
        {
            ch = str.charAt(i);
            ch1 = str.charAt(i+1);
            if (i==0 && ch=='A')
                c++;
            else if (ch==' ' && ch1=='A')
                c++;
        }
        System.out.println("Number of words started with letter 'A' = "+c);
    }//end of function
}//end of class