Help coding simple python function?

I'm supposed to write a recursive function called count_xx(str) that counts the number of times "xx" appears in the input string. The "xx" substrings must not overlap.

brilliant_moves2016-02-23T15:33:57Z

Hi Audrey. This is one solution:

def count_xx(str):
... count = 0
... found_x = False
... for ch in str:
... ... if ch=='x':
... ... ... if found_x:
... ... ... ... count += 1
... ... ... ... found_x = False
... ... ... else:
... ... ... ... found_x = True
... ... else:
... ... ... found_x = False

... return count

def main():
... print (count_xx ("axbxxcxxxx"))

main()

#Note: I've used "... " to show indentation. Replace dots with tabs/spaces.