Need to change every word, that starts with vowel to the longest one. Everything seems ok, however have faced with an unexpected behaviour from the loop, when I enter into it - scanner wants an input (7th line). Instead of asking for an input, it should iterate through every element (word) from the sentence I've set previously (2nd line). I do assume, that I've missed something.
    Scanner sc = new Scanner(System.in);
    String textToFormat = sc.nextLine();
    Pattern pattern = Pattern.compile(regex);
    Matcher matcher = pattern.matcher(textToFormat);
    while (sc.hasNext()) {
      currentWord = sc.next();
      if (currentWord.length() > longestWord.length()) {
        longestWord = currentWord;
      } else break;
    }
 
    