You are on page 1of 2

import java.util.

Scanner;
public class VowelStartReplace {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter the sentence");
String st=scan.nextLine();
st=st.trim()+" ";
st=st.toLowerCase();
String word="";
String res="";
char ch1='\u0000';
for (int i = 0; i < st.length(); i++) {
char ch =st.charAt(i);
if(ch!=32){
word=word+ch;
ch1=word.charAt(0);
System.out.println(word.length());
}
else{
if (ch1=='a'||ch1=='u'||ch1=='e'||ch1=='i'||ch1=='o'||ch1=='A'||
ch1=='E'||ch1=='I'||ch1=='O'||ch1=='U'){
for (int j = 0; j < word.length(); j++) {
res=res+'*';
}
}
else{
res=res+word;
}
word="";
}
res=res+" ";
}
System.out.println(res);
scan.close();
}
}

import java.util.Scanner;
public class Casecount {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
String st=scan.nextLine();
st=st.trim();
st=st+" ";
String word="";
int lc=0;
int uc=0;
for (int i = 0; i < st.length(); i++) {
char ch=st.charAt(i);
if(ch!=32){
word=word+ch;
}
else{
char fl=word.charAt(0);
if(Character.isLowerCase(fl)){
lc++;
}
else if (Character.isUpperCase(fl)) {
uc++;
}
word="";
}
}
System.out.println("Number of word with lower case "+lc);
System.out.println("Number of word with upper case "+uc);
scan.close();
}
}

You might also like