Write a program that extracts and outputs all "keys" from a string.
The key is a set of characters surrounded by spaces. The key can be of two types:
- containing digits and/or upper- and lowercase English consonants in any combination;
- containing special symbols
?!#and/or upper- and lowercase English vowels in any combinations. Note thatyis considered to be a consonant in this task.
The key always follows the phrase the key is , which can be written in upper- and/or lowercase letters. Each word can be separated by any number of whitespace, including the key-word itself.
Output all keys found in the string, each key on a new line.
Be careful, the key is always surrounded by spaces or the input string ends with the key (see the second input).
For example, the string "The key is d123." won't contain any keys.
Try to use Matcher and Pattern to solve it. All the needed modules are already imported.