Word Correction
Hint: When does some vowel stay in string?
Solution
Iterate over the string, output only consonants and vowels which don't have a vowel before them.
Run For Your Prize
Hint 1: It's never profitable to go back. No prizes left where you have already gone.
Hint 2
Hint 2: The optimal collecting order will be: some prefix of prizes to you and the other prizes to your friend (some suffix).
Solution
You can find the total time with the knowledge of the prefix length. The final formula is .