import java.util.Scanner;

public class Lesson13AdvancedStrings {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // 2. Get user input
        System.out.print("Enter a sentence: ");
        String sentence = scanner.nextLine();

        // 3. Convert to uppercase
        String upperSentence = sentence.toUpperCase();
        System.out.println("Uppercase sentence: " + upperSentence);

        // 4. Replace spaces with underscores
        String replacedSentence = sentence.replace(" ", "_");
        System.out.println("Replaced sentence: " + replacedSentence);

        // 5. Split the sentence into words
        String[] words = sentence.split(" ");
        System.out.println("Words in the sentence:");
        for (String word : words) {
            System.out.println(word);
        }

        ////////// HOMEWORK //////////////////
        // 0. Ask the user for a sentence
        System.out.println("Please enter a sentence:");
        String sentence1 = scanner.nextLine();

        // 1. Convert the sentence to lowercase
        String lowerCaseSentence = sentence1.toLowerCase();
        System.out.println("Sentence in lowercase: " + lowerCaseSentence);

        // 2. Replace all vowels with the asterisk * character
        String replacedSentence1 = lowerCaseSentence.replaceAll("[aeiou]", "*");
        System.out.println("Sentence with vowels replaced: " + replacedSentence1);

        // 3. Split the sentence into words and print the number of words
        String[] words1 = lowerCaseSentence.trim().split("\\s+");
        int wordCount = words1.length;
        System.out.println("Number of words in the sentence: " + wordCount);
        //////////////////////////////////////////

        scanner.close();
    }
}