Suppose we have a string s. We have to check whether the vowels present in s are in alphabetical order or not.
So, if the input is like s = "helloyou", then the output will be True as vowels are e, o, o, u all are in alphabetical order.
To solve this, we will follow these steps −
Let us see the following implementation to get better understanding −
def solve(s): character = chr(64) for i in range(len(s)): if s[i] in ['A','E','I','O','U','a','e','i','o','u']: if s[i] < character: return False else: character = s[i] return True s = "helloyou" print(solve(s))