# Help me in solving CLOSEVOWEL problem

### My issue

for _ in range(int(input())):
n= int(input())
s= str(input())
count=1
alphabet=‘abcdefghijklmnopqrstuvwxyz’
vowels=‘aeiou’
a=alphabet.find(‘a’)
e=alphabet.find(‘e’)
i=alphabet.find(‘i’)
o=alphabet.find(‘o’)
u=alphabet.find(‘u’)

for item in s:
if item not in vowels:
distance=[abs(alphabet.find('item')-a),abs(alphabet.find('item')-e),abs(alphabet.find('item')-i),abs(alphabet.find('item')-o),abs(alphabet.find('item')-u)]
if (distance.count(min(distance)))>1 :
count+=1

print(count)


‘’‘where is this code going wrong??’‘’

### My code

# cook your dish here
for _ in range(int(input())):
n= int(input())
s= str(input())
count=1
alphabet='abcdefghijklmnopqrstuvwxyz'
vowels='aeiou'
a=alphabet.find('a')
e=alphabet.find('e')
i=alphabet.find('i')
o=alphabet.find('o')
u=alphabet.find('u')

for item in s:
if item not in vowels:
distance=[abs(alphabet.find('item')-a),abs(alphabet.find('item')-e),abs(alphabet.find('item')-i),abs(alphabet.find('item')-o),abs(alphabet.find('item')-u)]
if (distance.count(min(distance)))>1 :
count+=1

print(count)



Problem Link: CLOSEVOWEL Problem - CodeChef

@himasreep
Your logic is not right.
U have to search for the closest vowel then place it over .
Like for abcde
put ans=1 initially .
for b ,i have only one closest option which is a so multiply ans with 1 .
now for c , i have two options which are closest which is a and e so multiply ans with 2.
at the end for d i have one option which is e so multiple ans with 1.
finally i get ans=121 which is 2.
and also u have to take mod with 1e9 +7 after each multiplication.