The aim of this Kata is to write a function which will reverse the case of all consecutive duplicate letters in a string.  That is, any letters that occur one after the other and are identical.

If the duplicate letters are lowercase then they must be set to uppercase, and if they are uppercase then they need to be changed to lowercase. 

**Examples:**
```python
reverse_case("puzzles")    Expected Result: "puZZles"
reverse_case("massive")    Expected Result: "maSSive"
reverse_case("LITTLE")     Expected Result: "LIttLE"
reverse_case("shhh")       Expected Result: "sHHH"
```

Arguments passed will include only alphabetical letters A–Z or a–z.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def reverse(s):
	

Solutions:
import re

def reverse(s):
	return re.sub('(.)\\1+', lambda m: m.group().swapcase(), s)


import re

def reverse(strng):
	return re.sub('(\\w)\\1+', lambda m: m.group().swapcase(), strng)


import re

def reverse(stg):
	return re.sub('(([a-zA-Z])\\2+)', lambda m: m.group(1).swapcase(), stg)


from functools import partial
from re import compile
reverse = partial(compile('(.)\\1+').sub, lambda s: s.group().swapcase())


reverse = lambda s: __import__('re').sub('(.)\\1+', lambda x: x.group(0).swapcase(), s)


def reverse(s):
	(index, l) = (0, [[]])
	for x in s:
		if x in l[index]:
			l[index].append(x)
		elif not l[index]:
			l[index].append(x)
		else:
			l.append([x])
			index += 1
	return ''.join((''.join((c.swapcase() for c in x)) if len(x) > 1 else x.pop() for x in l))


def reverse(s):
	s = list(s)
	indexes = []
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			indexes.append(i)
			indexes.append(i + 1)
	for i in list(set(indexes)):
		s[i] = s[i].swapcase()
	return ''.join(s)


from re import sub

def reverse(string):
	return sub('(\\w)\\1+', lambda m: m.group().swapcase(), string)


def reverse(s):
	ss = ''
	for i in range(len(s)):
		if i > 0 and s[i] == s[i - 1] or (i < len(s) - 1 and s[i] == s[i + 1]):
			ss += s[i].swapcase()
		else:
			ss += s[i]
	return ss


from itertools import groupby

def reverse(str):
	reversal = ''
	for (k, g) in groupby(str):
		l = list(g)
		if len(l) > 1:
			reversal += ''.join(l).swapcase()
		else:
			reversal += k
	return reversal