Question: 
Write a function to count those characters which have vowels as their neighbors in the given string.


Model's Code:
def count_vowels(s):
    vowels = set('aeiou')
    count = 0
    for i in range(len(s)):
        if (i > 0 and s[i-1] in vowels) or (i < len(s) - 1 and s[i+1] in vowels):
            count += 1
    return count



Sample Correct Code:
def count_vowels(test_str):
  res = 0
  vow_list = ['a', 'e', 'i', 'o', 'u']
  for idx in range(1, len(test_str) - 1):
    if test_str[idx] not in vow_list and (test_str[idx - 1] in vow_list or test_str[idx + 1] in vow_list):
      res += 1
  if test_str[0] not in vow_list and test_str[1] in vow_list:
    res += 1
  if test_str[-1] not in vow_list and test_str[-2] in vow_list:
    res += 1
  return (res) 


Asserts:
assert count_vowels('bestinstareels') == 7
assert count_vowels('partofthejourneyistheend') == 12
assert count_vowels('amazonprime') == 5


Tests:
Test 1 of 3: FAIL: AssertionError()

Test 776 of 974: 587/776 (75.64432989690721%): failed