There are n cards of different colours placed in a line, each of them can be either red, green or blue cards. Count the minimum number of cards to withdraw from the line so that no two adjacent cards have the same colour.

-----Input-----
- The first line of each input contains an integer n— the total number of cards.
- The next line of the input contains a string s, which represents the colours of the cards. We'll consider the cards in a line numbered from 1 to n from left to right. Then the $i^t$$^h$ alphabet equals "G", if the $i^t$$^h$ card is green, "R" if the card is red,  and "B", if it's blue.

-----Output-----
- Print a single integer — the answer to the problem.

-----Constraints-----
- $1 \leq n \leq 50$

-----Sample Input 1:-----
5
RGGBG

-----Sample Input 2:-----
5
RRRRR

-----Sample Input 3:-----
2
BB

-----Sample Output 1:-----
1

-----Sample Output 2:-----
4

-----Sample Output 3:-----
1

Difficulty: UNKNOWN_DIFFICULTY

Starter code:

Solutions:
n = int(input())
s = [i for i in input()]
count = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		count += 1
	else:
		continue
print(count)


n = int(input())
string1 = input()
count = 0
if n == 1:
	print(0)
else:
	for i in range(len(string1) - 1):
		if string1[i + 1] == string1[i]:
			count += 1
	print(count)


def chef(n, a):
	c = 0
	for i in range(len(a) - 1):
		if a[i] == a[i + 1]:
			c += 1
	return c
c = int(input())
b = input()
print(chef(c, b))


n = int(input())
df = str(input())
df = list(df)
ans = 0
l = len(df)
i = 1
while l > 1:
	if i < len(df) - 1:
		if df[i - 1] == df[i]:
			df.pop(i)
			l -= 1
			ans += 1
		else:
			i += 1
	else:
		break
l = len(df)
if l > 1:
	if df[l - 1] == df[l - 2]:
		ans += 1
print(ans)


n = int(input())
l = list(input())
j = 0
count = 0
while j < len(l) - 1:
	if l[j] == l[j + 1]:
		j -= 1
		count += 1
		l.pop(j + 1)
	j += 1
print(count)


n = int(input())
s = input()
s = list(s)
ans = 0
for i in range(1, len(s)):
	if s[i] == s[i - 1]:
		ans += 1
print(ans)


n = int(input())
s = input()
count = 0
for i in range(n):
	if i + 1 == n:
		break
	if s[i] == s[i + 1]:
		count += 1
print(count)


n = int(input())
s = input()
count = 0
l = list(s)
for i in range(0, n - 1):
	if l[i] == l[i + 1]:
		count = count + 1
print(count)


n = int(input())
s = input()
l = list(s)
i = ans = j = 0
while i < n - 1:
	if s[i] == s[i + 1]:
		ans += 1
	i += 1
print(min(ans, n - 1))


n = input()
x = input()
c = 0
for i in range(1, len(x)):
	if x[i] == x[i - 1]:
		c += 1
print(c)


n = int(input())
st = input()
cnt = 0
for i in range(len(st) - 1):
	if st[i] == st[i + 1]:
		cnt += 1
print(cnt)


test = int(input())
count = 0
s = input()
for i in range(test - 1):
	if s[i + 1] == s[i]:
		count += 1
print(count)


n = int(input())
ar = input()
count = 0
for x in range(1, n):
	if ar[x] == ar[x - 1]:
		count += 1
print(count)


n = int(input())
s = input()
count = 0
for j in range(n - 1):
	if s[j] == s[j + 1]:
		count += 1
print(count)


n = int(input())
s = input()
l = []
for i in s:
	l.append(i)
ans = 0
for i in range(1, len(s)):
	if l[i - 1] == l[i]:
		ans += 1
print(ans)


n = int(input())
s = input()
b = 0
i = 0
j = 0
while i < n - 1:
	j = i + 1
	while j < n:
		if s[i] == s[j]:
			b += 1
			j += 1
			i += 1
		else:
			i = j
			break
print(b)


n = int(input())
st = str(input())
count = 0
while len(st) > 0:
	h = 0
	if 'RR' in st:
		i = st.index('RR')
		st = st[:i] + st[i + 1:]
		count += 1
		h = 1
	if 'GG' in st:
		i = st.index('GG')
		st = st[:i] + st[i + 1:]
		h = 1
		count += 1
	if 'BB' in st:
		i = st.index('BB')
		st = st[:i] + st[i + 1:]
		h = 1
		count += 1
	if h == 0:
		break
print(count)


n = int(input())
s = list(str(input()))
i = 0
ans = 0
while i < len(s) - 1:
	if s[i] == s[i + 1]:
		del s[i + 1]
		ans += 1
	else:
		i += 1
print(ans)


n = int(input())
c = 0
l = str(input())
for i in range(n - 1):
	if l[i] == l[i + 1]:
		c += 1
print(c)


n = int(input())
a = input()
e = a[0]
f = 0
for i in range(1, n):
	if a[i] == e:
		f += 1
	else:
		e = a[i]
print(f)


l = int(input())
s = input()
i = 0
c = 0
s = list(s)
while i < len(s) - 1:
	if s[i] == s[i + 1]:
		c += 1
		s.remove(s[i])
		i -= 1
	i += 1
print(c)