
1) Take a string as input from command line and find the following: a) Length of the string b) number of vowels in it c) number of characters in it d) number of digits in it e) how many uppercase letters are present and how many lowercase f) reverse the string and print it out

import java.util.*;
class StringExample
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("Enter string: ");
String str=input.nextLine();
int len=str.length();
int count = 0,numOfLetters=0,numberOfDigits=0,uc=0,lc=0;
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u') {
count++;
}
if(Character.isLetter(c)){
numOfLetters++;
}
if(Character.isDigit(c)){
numberOfDigits++;
}
if(Character.isUpperCase(c)){
uc++;
}
if(Character.isLowerCase(c)){
lc++;
}
}
System.out.println("Length of String :"+len);
System.out.println("Number of Vowels :"+count);
System.out.println("Number of Letters :"+numOfLetters);
System.out.println("Number of Digits :"+numberOfDigits);
System.out.println("Number of UpperCase Letters :"+uc);
System.out.println("Number of LowerCase Letters :"+lc);
}
}