Im having difficulty finding an algorithm for the following puzzle- 
A string is called ugly if it has 3 vowels in a row, or 5 consonants in a row, or both. A string is called nice if it is not ugly. You are given a string s, consisting of uppercase letters ('A'-'Z') and question marks ('?'). 
Can you find an algorithm that tells if the string can be made nice by substituting the question marks with alphabets? 

Example - 

1. "EE?FFFF" - Cant be made nice. Inserting either a consonant or a vowel would make it ugly.
2. "H??LOWOR??" - Can be made nice.

P.S - Not homework, but a part of a programming puzzle on the internet.