import java.util.
Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a string: ");
String input = scanner.nextLine();
int vowels = 0, consonants = 0;
for (char ch : input.toLowerCase().toCharArray()) {
if (Character.isLetter(ch)) { // Check if it's a letter
if ("aeiou".indexOf(ch) != -1) vowels++;
else consonants++;
}
}
System.out.println("Vowels: " + vowels);
System.out.println("Consonants: " + consonants);
}
}
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a string: ");
String input = scanner.nextLine();
System.out.print("Enter the word to find: ");
String word = scanner.nextLine();
int index = input.indexOf(word);
System.out.println(index != -1 ? "Word found at index: " + index : "Word
not found.");
}
}
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a date (dd/MM/yyyy): ");
Date date = new SimpleDateFormat("dd/MM/yyyy").parse(scanner.nextLine());
System.out.println(new SimpleDateFormat("dd MMM yyyy").format(date));
}
}