# Task
 Let's say that `"g" is happy` in the given string, if there is another "g" immediately to the right or to the left of it.
 
 Find out if all "g"s in the given string are happy.

# Example
 For `str = "gg0gg3gg0gg"`, the output should be `true`.
 
 For `str = "gog"`, the output should be `false`.

# Input/Output


 - `[input]` string `str`

  A random string of lower case letters, numbers and spaces.


 - `[output]` a boolean value

  `true` if all `"g"`s are happy, `false` otherwise.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Ad-hoc

Starter code: def happy_g(s):
	

Solutions:
import re

def happy_g(s):
	return not re.search('(?<!g)g(?!g)', s)


import re

def happy_g(s):
	return re.sub('g{2,}', '', s).count('g') < 1


import re

def happy_g(s):
	return bool(re.match('^(g{2,}|[^g])+$', s))


from itertools import groupby

def happy_g(s):
	return all((c != 'g' or sum((1 for _ in g)) > 1 for (c, g) in groupby(s)))


import re

def happy_g(s):
	return all((len(i) > 1 for i in re.findall('g+', s)))


from itertools import groupby

def happy_g(s):
	return all((False if k == 'g' and len(list(g)) == 1 else True for (k, g) in groupby(s)))


import re

def happy_g(s):
	for i in re.sub('g{2,}', '', s):
		if i.count('g') == 1:
			return False
	return True