# Task
 Mr.Odd is my friend. Some of his common dialogues are “Am I looking odd?” , “It’s looking very odd” etc. Actually “odd” is his favorite word.

 In this valentine when he went to meet his girlfriend. But he forgot to take gift. Because of this he told his gf that he did an odd thing. His gf became angry and gave him punishment.

 His gf gave him a string str of contain only lowercase letter and told him,
 
 “You have to take 3 index `i,j,k` such that `i ".u..dbo"(no more odd)`
 
 For `str="ooudddbd"`, the result should be `2`.
 
 `"ooudddbd"(cut 1st odd)--> ".ou..dbd"(cut 2nd odd) --> "..u...b."`
 
# Input/Output


 - `[input]` string `str`

  a non-empty string that contains only lowercase letters.
  
  `0 < str.length <= 10000`


 - `[output]` an integer

  the maximum number of "odd".

Difficulty: EASY
Tags: Ad-hoc

Starter code:
def odd(s):
	

Solutions:
import re
pattern = re.compile('o(.*?)d(.*?)d')

def odd(s):
	n = 0
	while pattern.search(s):
		n += 1
		s = pattern.sub('\\1\\2', s, count=1)
	return n


import re
o = re.compile('o(.*?)d(.*?)d')

def odd(stg):
	count = 0
	while o.search(stg):
		count += 1
		stg = o.sub('\\1\\2', stg, 1)
	return count


def odd(s):
	o = d = res = 0
	for c in filter('od'.__contains__, s):
		if c == 'o':
			o += 1
		elif o and d:
			(o, d, res) = (o - 1, d - 1, res + 1)
		elif o:
			d += 1
	return res


def odd(string):
	(li, i, string) = ([], 0, list(string))
	while i < len(string):
		if string[i] == 'o':
			(temp, pos_to_remove) = (['o'], [i])
			for j in range(i + 1, len(string)):
				if string[j] == 'd':
					temp.append('d')
					pos_to_remove.append(j)
				if len(temp) == 3:
					break
			if ''.join(temp) == 'odd':
				li.append(1)
				for k in pos_to_remove:
					string[k] = '.'
		i += 1
	return len(li)


def odd(s):
	r = [i for i in s.lower() if i == 'o' or i == 'd']
	result = []
	while True:
		word = ''
		try:
			o = r.index('o')
			d = r[o + 1:].index('d') + o + 1
			d2 = r[d + 1:].index('d') + d + 1
			word += r.pop(d2) + r.pop(d) + r.pop(o)
			if word[::-1] == 'odd':
				result.append(word)
		except Exception:
			break
	return len(result)


import re

def odd(s):
	for c in range(len(s)):
		(last, s) = (s, re.sub('o(.*?)d(.*?)d', '\\1\\2', s, count=1))
		if last == s:
			return c


def odd(s):
	odds = list(s)
	for i in odds:
		if i != 'o' and i != 'd':
			odds.remove(i)
	x = 3
	num = 0
	t = 0
	flag = True
	m = [2, 1]
	l_index = []
	while x == 3:
		if flag == False:
			odds[0:l_index[0]]
			for i in l_index:
				odds.pop(i - t)
				t = t + 1
			x = 0
			t = 0
			num = num + 1
			l_index = []
			index = 0
		else:
			x = 0
			index = 0
		for i in odds:
			if x == 0 and i == 'o':
				x = x + 1
				l_index.append(index)
			elif x in m and i == 'd':
				x = x + 1
				l_index.append(index)
				flag = False
			index = index + 1
	return num


def odd(s):
	(n, o, d, trying) = (0, 0, 0, True)
	while trying:
		try:
			o += s[o:].index('o') + 1
			d = max(o, d)
			d += s[d:].index('d') + 1
			d += s[d:].index('d') + 1
			n += 1
		except:
			trying = False
	return n


def odd(s):
	odd = 0
	l = [x for x in s]
	while True:
		try:
			o = l.index('o')
			d1 = l.index('d', o)
			d2 = l.index('d', d1 + 1)
		except ValueError:
			return odd
		if o > -1 and d1 > -1 and (d2 > -1):
			l.pop(d2)
			l.pop(d1)
			l.pop(o)
			odd += 1
		else:
			return odd


def odd(s):
	s = list(s)
	count = 0
	for k in range(len(s)):
		if s[k] == 'o':
			for i in range(k + 1, len(s)):
				if s[i] == 'd':
					for j in range(i + 1, len(s)):
						if s[j] == 'd':
							s[k] = '_'
							s[i] = '_'
							s[j] = '_'
							count += 1
							break
					break
	return count