Computer Science, asked by akathait321, 7 months ago

write a program to enter a sentence and print the word which contain maximum number of caracter​

Answers

Answered by sheelayadavy782167
1

Answer:

dont know..............

Answered by yadavkumarmohi52
0

Answer:

example :                  input:  India is my country

                                 output: INDIA

import java.io.*;

public class HighestVowel

{                                  // start of class

    static void main()throws IOException

    {                              //start of main ()

        InputStreamReader isr= new InputStreamReader(System.in);

BufferedReader br= new BufferedReader(isr);

System.out.print("Enter a String= ");

String s=br.readLine();

    String s1,s2="";

    s=s+" ";

    s=s.toUpperCase();

    int n=s.length();

    int i,j,m,p=0;

    int countvowel=0,totalvowel=0;

    

    char ch;

    for(i=0;i<n;i++)

    {                   //start of loop i for main string

        

    if(s.charAt(i)==' ')

    {                   //start of if for space

        s1="";

     countvowel=0;

    s1=s.substring(p,i);

    p=i+1;

    m=s1.length();

    for(j=0;j<m;j++)

    {                   // start of loop j for substring

    ch=s1.charAt(j);

    if(ch=='A' || ch=='E' || ch=='I'|| ch=='O'|| ch=='U')

    {                       //start of if for counting the number vowel in substring

    countvowel++;

     

    }                       //end of if for counting the number vowel in substring

    

    }                   // end of loop j for substring

     

    if(totalvowel<countvowel)

    {                    //start of if for checking maximum number of vowel

    s2=s1;

    totalvowel=countvowel;

    }                   //end of if for checking maximum number of vowel

    }                   //end of if for space

    

    }                   //end of loop i for main string

    System.out.print("The word with maximum number of vowel is: "+s2);

    

    

    }                    //end of main ()

}                        // end of class

Similar questions