Write a function that returns the count of characters that have to be removed in order to get a string with no consecutive repeats.

*Note:* This includes any characters

##  Examples

```python
'abbbbc'  => 'abc'    #  answer: 3
'abbcca'  => 'abca'   #  answer: 2
'ab cca'  => 'ab ca'  #  answer: 1
```

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def count_repeats(txt):
	

Solutions:
from itertools import groupby

def count_repeats(s):
	return len(s) - len(list(groupby(s)))


def count_repeats(str):
	return sum((a == b for (a, b) in zip(str, str[1:])))


from itertools import groupby

def count_repeats(txt):
	return len(txt) - sum((1 for _ in groupby(txt)))


import re

def count_repeats(str):
	return len(str) - len(re.sub('(.)\\1+', '\\1', str))


def count_repeats(string):
	temp = ''
	count = 0
	for i in list(string):
		if i == temp:
			count += 1
		temp = i
	return count


def count_repeats(txt):
	a = 0
	for i in range(0, len(txt) - 1):
		if txt[i] == txt[i + 1]:
			a += 1
	return a


def count_repeats(txt):
	return sum((a == b for (a, b) in zip(txt, txt[1:])))


import re

def count_repeats(str):
	return sum((len(i[0]) - 1 for i in re.findall('((.)\\2+)', str)))


count_repeats = lambda s: sum((sum((1 for _ in n)) - 1 for (_, n) in __import__('itertools').groupby(s)))


def count_repeats(txt):
	prev = None
	removed_chars = 0
	for ch in txt:
		if ch == prev:
			removed_chars += 1
		prev = ch
	return removed_chars