Problem:


Score : 300 points

Problem Statement

There are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i-th slime from the left has the color that corresponds to the i-th character of S.

Adjacent slimes with the same color will fuse into one larger slime without changing the color. If there were a slime adjacent to this group of slimes before fusion, that slime is now adjacent to the new larger slime.

Ultimately, how many slimes will be there?

Constraints

1 \leq N \leq 10^5

|S| = N

S consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

N
S

Output

Print the final number of slimes.

Sample Input 1

10
aabbbbaaca

Sample Output 1

5

Ultimately, these slimes will fuse into abaca.

Sample Input 2

5
aaaaa

Sample Output 2

1

All the slimes will fuse into one.

Sample Input 3

20
xxzaffeeeeddfkkkkllq

Sample Output 3

10



Sample input:
10
aabbbbaaca


Sample output:
5

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()


current = ""
ans = ""
for s in S:
    if s != current:
        current = s
        ans += s

# print(len(ans))
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
ans=''
pass_count=0
for i in range(n):
  if i == (n-1):
    break
  if s[i] == s[i+1]:
    pass_count+=1
    pass
  else:
    ans=ans+s[i]
    if i==(n-2):
      ans+=s[i+1]
if pass_count == n-1:
  print('1')
else:
  print(len(ans))

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
ans=''
pass_count=0
for i in range(n):
  if i == (n-1):
    break
  if s[i] == s[i+1]:
    pass_count+=1
    pass
  else:
    ans=ans+s[i]
    if i==(n-2):
      ans+=s[i+1]
if pass_count == n:
  print('1')
else:
  print(len(ans))

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
ans=''
for i in range(n):
  if i == (n-1):
    break
  if s[i] == s[i+1]:
    pass
  else:
    ans=ans+s[i]
    if i==(n-2):
      ans+=s[i+1]
print(len(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
x = list(input())
for i in range(n-1,1,-1):
  if x[i]==x[i-1]:
    x.pop(i)
print(len(x))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
res = 0
for i in range(n-1):
  if s[i] != s[i+1]:
    res += 1
print(res)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
k=0
l=set(s)
if len(l)==1:
    print(len(l))
    exit()
for i in range(n-1):
    if s[i]==s[i+1]:
        k+=1
print(k)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=input()
ct=0
for i in range(N-1):
  if S[i]!=S[i+1]:
    ct+=1
print(ct)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()

count = 0
for i in range(N-1):
  if S[i]==S[i+1]:
    count += 1
    
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instr = lambda: sys.stdin.readline()
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
s = instr()

prev = s[0]
now = 0
ans = 0

for i in range(1,n):
    if s[i] == prev:
        now += 1
    else:
        if now % 2 == 1:
            if now == 1:
                ans += 1
            else:
                ans += 2
        else:
            ans += 1
        prev = s[i]
        now = 1
    if i == n-1:
        if now == 1:
            ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instr = lambda: sys.stdin.readline()
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
s = instr()

prev = s[0]
now = 0
ans = 1

for i in range(1,n):
    if s[i] == prev:
        now += 1
    else:
        if now % 2 == 1:
            if now == 1:
                ans += 1
            else:
                ans += 2
        else:
            ans += 1
        prev = s[i]
        now = 1

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()

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

Submission status: Wrong Answer

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
S = _S()
#Ap = np.array(A)
#C = np.zeros(N + 1)

last = ''
count = 0
for i in range(N):
    a = S[i]
    if last == a:
        count += 1
    else:
        last = a
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input());s=input();result=[];left,right=0,1
if len(set(s))==1: print(1);exit()
for i in range(1,n):
  if s[i-1]!=s[i]:
    result.append(s[i-1])
    if i==n-1:
      result.append(s[i])
print(len(result))

Submission status: Wrong Answer

Solution code:
n=int(input());s=input();result=[];left,right=0,1
for i in range(1,n):
  if s[i-1]!=s[i]:
    result.append(s[i-1])
    if i==n-1:
      result.append(s[i])
print(1 if n!=0 and not result else len(result))

Submission status: Wrong Answer

Solution code:
N=int(input())
S=input()
K=S
i=0
han=S[0]
kot=S[0]

for b in K:
    if b != han:
        kot+=b
        han=b


print(kot)
print(len(kot))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
S = str(input())

ans = ""
ans += S[0]

for i in range(1,N-1):
  if S[i] != S[i+1]:
    ans += S[i+1]
print(len(ans))

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
for i in range(n):
    if i==n-1:
        print(s[i])
        continue
    if s[i]!=s[i+1]:
        print(s[i],end='')

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
print(len(set(S)))

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(input())
if N == 1:
  print(1)
if N>=2:
  if S[0] == S[1]:
    S[0]==" "
  for i in range(1,N):
    if S[i-1]==S[i]:
      S[i-1]=" "
A=[]
for i in range(N):
      if S[i]!=" ":
            A.append(S[i])
print(len(A))

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(input())
for i in range(N):
  if S[i-1]==S[i]:
    S[i-1]=" "
A=[]
for i in range(N):
      if S[i]!=" ":
            A.append(S[i])
print(len(A))

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(input())
for i in range(N):
  if S[i-1]==S[i]:
    S[i-1]=""
L=" ".join([str(i) for i in S])
print(L)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(input())
for i in range(N):
  if S[i-1]==S[i]:
    S[i-1]==""
print(len(S))

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(input())
ans = 0
for i in range(1,N):
  if S[i-1]==S[i]:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()

ans = 0
p = S[0]
for i in range(1, N):
    if S[i] == p:  continue
    else:
        ans += 1
        p = S[i]
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()

cnt = 0

for i in range(n-1):
    if s[i] != s[i+1]:
        cnt += 1
    
    if cnt == 0:
        cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    s = list(input())
    cnt = 1
    for i in range(2, n):
        if s[i] == s[i-1]:
            continue
        else:
            cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()

ans = ''
seek = 0

while seek < n:
    first = seek
    while seek < n and s[seek] == s[first]:
        seek += 1
    ans += s[first]

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
S_ = []

for i in range(len(S)-1):
    if i == len(S)-2 and S[i] != S[i+1]:
        S_.append(S[i])
        S_.append(S[i+1])
    elif S[i] != S[i+1]:
        S_.append(S[i])
if len(S_) == 0:
    print('1')
else:
    print(len(S_))

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()

i, j = 0, 1
count = 0
while j < N:
  if j < N-1:
    if S[i] == S[j]:
      j += 1
    elif S[i] != S[j]:
      count += 1
      i = j
      j += 1
  elif j == N-1:
    if S[i] == S[j]:
      count += 1
    elif S[i] != S[j]:
      count += 2
    break
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
count = 0

for i in range(n - 1):
    if s[i] != s[i + 1]:
        count += 1

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input()) 
s = input()

ans = set(s)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()

s = list(s)

#ダミー要素
s.append("s")
ans = []
tmp = []
for i in range(0,n):
  #print(tmp)
  if(s[i] != s[i+1]):
    s[i] = "z"

print(s.count("z"))

Submission status: Wrong Answer

Solution code:
n = int(input())
s= list(input())
ans = []
tmp = s[0]

if len(set(s)) == 1:
    print(1)
    exit()

for i in range(1, n):
    if s[i] == tmp:
        continue
    else:
        ans.append(tmp)
        tmp = s[i]

if s[-1] == s[-2]:
    print(len(ans))
else:
    ans.append(s[-1])
    print(len(ans))

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import collections
import numpy as np

rl = sys.stdin.readline
n = int(rl())
s = rl()
cnt = 0
for i in range(n-1):
  if s[i] != s[i+1]:
    cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()

s = list(set(list(s)))

print(len(s))

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
X = ""
for i in range(N):
  if(len(X) == 0):
    X = X + S[i]
  else:
    if(X[-1] != S[i]):
      X = X + S[i]
print(X)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    l=[]
    n=int(input())
    s=input()
    for i in range(n-1):
        if s[i]!=s[i+1]:
            l.append(s[i])
        if i==n-2 and s[i]!=s[i+1]:
            l.append(s[-1])
    if len(l)==0:
        print(1)
    else:
        print(len(l))
resolve()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
count=0

for i in range(n-1):
    if i==0:
        count += 1
        if s[i] != s[i+1]:
            count += 1
    if s[i] != s[i+1]:
        count += 1

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
count=0

for i in range(n-1):
    if i==0:
        count += 1
    if s[i] != s[i+1]:
        count += 1

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
s = input()

count = 0
prev = None
for i in list(s):
  if i!=prev:
    count += 1
    
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()


cnt = 1
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
string = str(input())
string =list(string)
index = 0 
i = 0
res = []
# print(string[index])
while index<len(string):
	res.append(string[index])
	# print(res[-1])
	while index<len(string) and res[-1]==string[index]:
		index+=1
	i+=1
print(len(res))

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(input())
p=0


for i in range(N-1):
  if S[i]==S[i+1]:
    N-=1

print(S)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
di ={}
answer = 0
for i in s:
  if i in di:
    continue
  else:
    di[i] = 1
    answer += 1
    
print(answer)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = list(input())
from collections import OrderedDict
ll = list(OrderedDict.fromkeys(li).keys())
s = ''
for i in range(len(ll)):
  s += ll[i]
print(s)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
l=[]
for i in range(n-1):
    if s[i]!=s[i+1]:l.append(s[i])
    if i==n-2 and s[i]!=s[i+1]:l.append(s[i+1])
if len(l)==0:print(1)
else:print(len(l))

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
l=[]
for i in range(n-1):
    if i==0:l.append(s[0])
    elif s[i]!=s[i+1]:l.append(s[i])
    if i==n-2 and s[i]!=s[i+1]:l.append(s[i+1])
print(len(l))

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
l=[]
for i in range(n-1):
    if s[i]!=s[i+1]:l.append(s[i])
    if i==n-2 and s[i]!=s[i+1]:l.append(s[i+1])
print(len(l))

Submission status: Wrong Answer

Solution code:
n=int(input())
s=str(input())
same=0
i=0
for i in range(n-2):
  if s[i]==s[i+1]:
    same+=1
    i+=1
print(n-same)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=str(input())
a=[]
if len(set(S))==1:
  print(1)
else:
  for i in range(1,N):
    if S[i]!=S[i-1]:
      a.append(S[i])
  if S[N-1]!=S[N-2]:
    a.append(S[-1])
  print(len(a))

Submission status: Wrong Answer

Solution code:
N=int(input())
S=str(input())
a=[]
a.append(S[0])
for i in range(1,N-1):
  if S[i]!=S[i+1]:
    a.append(S[i])
if S[N-1]!=S[N-2]:
  a.append(S[-1])
print(len(a))

Submission status: Wrong Answer

Solution code:
"""
int(input())
map(int,input().split())
list(map(int,input().split()))

"""

n=int(input())
s=input()
a=''
for i in range(n-1):
    if(s[i]!=s[i+1]):
        a+=s[i]
if(s[n-1]!=s[n-2]):
    a+=s[n-1]
print(len(a))

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(input())

pointer1 = 0
pointer2 = 1
ans = []
ans.append(s[0])
while (pointer2 <= n-1):
  if s[pointer2] == s[pointer1]:
    pointer2 += 1
  elif s[pointer2] != s[pointer1]:
    pointer1 = pointer2
    pointer2 = pointer1 + 1 
    ans.append(s[pointer1])
    
print(''.join(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(input())
b =[a[0]]
for i in a:
  if i !=b[-1]:
    b.append(i)
print(*b,sep="")

Submission status: Wrong Answer

Solution code:
N=int(input())
S=input()
ans=[S[0]]
if len(S)==1:
  print(S[0])
  exit()
for i in range(1,N):
  if S[i]==S[i-1]:
    continue
  elif S[i]!=S[i-1]:
    ans.append(S[i])
print(len(ans))

Submission status: Wrong Answer

Solution code:
N=int(input())
S=input()
ans=[S[0]]
if len(S)==1:
  print(S)
  exit()
for i in range(1,N):
  if S[i]==S[i-1]:
    continue
  elif S[i]!=S[i-1]:
    ans.append(S[i])
print(len(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
out = ''
for i in range(1, n):
    if s[i] != s[i-1]:
        out += s[i-1]
    if i == n - 1:
        out += s[i]
print(len(out))

Submission status: Wrong Answer

Solution code:
N=int(input())
S=input().split()
ans=N
for i in range(1,len(S)):
  if S[i]==S[i-1]:
    ans-=1
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=input().split()
ans=N
for i in range(1,len(S)-1):
  if S[i]==S[i-1]:
    ans-=1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
readline = sys.stdin.buffer.readline

n = int(input())
s = input()

ans = ""

for i in range(n):
    if i == 0:
        ans = s[i]
    elif s[i] != s[i - 1]:
        ans += s[i]
    else:
        pass

print(ans)

Submission status: Wrong Answer

Solution code:

n = int(input())
s = list(input())
ans = [s[0]]
i = 1

for j in range(1,n-1):
    if s[j] == s[j + 1]:
        j += 1
    else:
        ans.append(s[j])
        j += 1

print(len(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()

x = s[0]
summe = 0
for i in s:
  if x != i:
    summe += 1
    x = i
    
print(summe)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(input())
 
i = 0
while i == N:
  if S[i] == S[i+1]:
    S.pop(i)
  else:
    i += 1
    
print(len(S))

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(input())

i = 0
while i == N:
  if S[i] == S[i+1]:
    S.pop(i)
    continue
  else:
    i += 1

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(str, input().split()))

print(S)

Submission status: Wrong Answer

Solution code:
def prob2(string):
    i=0
    counter =1
    while i<len(string)-1:
      if string[i] != string[i+1]: 
          counter=counter+1
      i+=1
    return counter
  
import sys
input = sys.stdin.readline()
d= prob2(input[:-1])
print(d)

Submission status: Wrong Answer

Solution code:
def prob2(string):
    i=0
    while len(string) > 1 and i<len(string)-1:
      if string[i] == string[i+1]: 
            string = string[:i]+string[i+1:] 
            i=i-1
      i=i+1
    return string
  
import sys
input = sys.stdin.readline()
d= prob2(input[:-1])
print(len(d))

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(input())

newS = []
for i in range(N-1):
    if S[i] != S[i + 1] and i != N-2:
        newS.append(S[i])
    elif S[i] != S[i + 1] and i == N-2 and S[i] != S[i-1]:
        newS.append(S[i])
        newS.append(S[i + 1])
    elif i == N-2 and S[i] and S[i] != S[i-1]:
        newS.append(S[i])


print(len(newS))

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(input())

newS = []
for i in range(N-1):
    if S[i] != S[i + 1] and i != N-2:
        newS.append(S[i])
    elif S[i] != S[i + 1] and i == N-2:
        newS.append(S[i])
        newS.append(S[i + 1])
    elif i == N-2:
        newS.append(S[i])


print(len(newS))

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
ans=1
b_c=s[0]
for i in s[1:]:
  if b_c!=i:
    ans+=1
  b_c=i

Submission status: Wrong Answer

Solution code:
_ = input()

chars = list(input())

if len(chars) == 1:
    print(1)
elif len(chars) == 0:
    print(0)

slime_num = 1
idx_0 = 0
idx_1 = 1

while idx_1 < len(chars):
    if chars[idx_0] != chars[idx_1]:
        slime_num += 1
    idx_1 += 1
    idx_0 += 1

print(slime_num)

Submission status: Wrong Answer

Solution code:
chars = list(input())

if len(chars) == 1:
    print(1)
elif len(chars) == 0:
    print(0)

slime_num = 1
idx_0 = 0
idx_1 = 1

while idx_1 < len(chars):
    if chars[idx_0] != chars[idx_1]:
        slime_num += 1
    idx_1 += 1
    idx_0 += 1

print(slime_num)

Submission status: Wrong Answer

Solution code:
chars = list("aabbbbaaca")

if len(chars) == 1:
    print(1)
elif len(chars) == 0:
    print(0)

slime_num = 1
idx_0 = 0
idx_1 = 1

while idx_1 < len(chars):
    if chars[idx_0] != chars[idx_1]:
        slime_num += 1
    idx_1 += 1
    idx_0 += 1

print(slime_num)

Submission status: Wrong Answer

Solution code:
from itertools import groupby
s = input()
print(len(list(groupby(s))))

Submission status: Wrong Answer

Solution code:
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
S = [str(i) for i in readline().decode('utf8').strip()]
print(len(set(S)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
sl = list(input())
ss = []
for i in range(1, n):
    if sl[i] != sl[i-1]:
        ss.append(sl[i-1])
    if i == n-1:
        ss.append(sl[i])
print(len(ss))

Submission status: Wrong Answer

Solution code:
n = int(input())
sl = list(input())
ss = []
count = 0
for i in range(1, n):
    if sl[i] != sl[i-1]:
        ss.append(sl[i-1])
    if i == n-1:
        ss.append(sl[i])
print(len(ss))

Submission status: Wrong Answer

Solution code:
input()
S=list(input())
print(sum(s!=t for s,t in zip(S,S[1:])))

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()

def run_length(s) -> list:
  res = [[s[0], 1]]
  for i in range(1, len(s)):
    if res[-1][0] == s[i]:
      res[-1][1] += 1
    else:
      res.append([s[i], 1])
  return res

answer = ""
for s, l in run_length(S):
  answer += s

print(answer)

Submission status: Wrong Answer

Solution code:
n = int(input())

li = list(input())

print(li)
count = 0
for i in range(len(li)-1):
    if li[i] == li[i+1]:
        count = count + 1

print(n-count)

Submission status: Wrong Answer

Solution code:
N = input()
S = input()
temp = ""
lst = ""
for cnt in S:
    if temp != cnt:
        temp = cnt
        lst += cnt
n = len("lst")
print("%d" % n)

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict

n = int(input())
p = str(input())

print(''.join(OrderedDict.fromkeys(p)))

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()

temp = 1
ansarray = []
counter = 0
for i in range(1, N):
    counter += 1
    if S[i] == S[i - 1]:
        temp += 1
    else:
        ansarray.append(temp)
        temp = 1
    if counter == N-1:
        ansarray.append(temp)
        print(len(ansarray))

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()

ans = []
for i in range(1, N):
    if S[i-1] != S[i]:
        ans.append(S[i-1])
if len(S) != 1 and S[-1] != S[-2]:
    ans.append(S[-1])
if len(set(S)) == 1 or len(S) == 1:
    ans.append(S[0])
print(len(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
x0 = S[0]
cnt = 1
for i in S:
    if i != x0:
        cnt += 1
    x0 = i
    print(x0)
print(cnt)

Submission status: Wrong Answer

Solution code:
#145
N = int(input())
S = input()
x0 = S[0]
cnt = 0
for i in S:
    if i != x0:
        cnt += 1
    x0 = i
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
x0 = S[0]
cnt = 0
for i in S:
    if i != x0:
        cnt += 1
    x0 = i
    print(x0)
print(cnt)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

N = int(input())
S = input()

print(S)

overlap = 0
for i in range(N-1) : 
    if S[i] == S[i+1] : 
        overlap += 1
print(N-overlap)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = str(input())
color = s[0]
cnt = 0
for i in range(n-1):
    if not color == s[i+1]:
        cnt += 1
        color == s[i+1]
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()

color_length = []
c = 1

for i in range(n-1):
    
    if s[i] == s[i+1]:
        c += 1
    
    else:
        color_length.append(c)
        c = 1

color_length.append(c)

print(color_length)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(input())
li = list()
for i in range(N-1):
    if S[i] != S[i+1]:
        li.append(S[i])
print(len(li))

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(input())
li = list()
for i in range(N-1):
    if S[i] != S[i+1]:
        li.append(S[i])
print(li)

Submission status: Wrong Answer

Solution code:
n=int(input())
d=list(input())
ans=0
for i in range(1,n):
    if d[i-1]!=d[i]:
        ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()

a = 0
for i in range(1, n):
  if s[i-1] != s[i]:
    a += 1
print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()

count = 0

for i in range(len(S)-1):
    if S[i+1] == S[i]:
        count+=1

print(count)

Submission status: Wrong Answer

Solution code:
N,S=open(0)
import itertools as i
print(len(list(i.groupby(S))))

Submission status: Wrong Answer

Solution code:
N,S=open(0)
import itertools as i
print(len(list(i.groupby(S))))

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
ans = 0
for i in range(N-1):
    if S[i] == S[i+1]:
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(input())
ans = []
for i in range(n-1):
  if n > i:
    if s[i] is not s[i+1]:
      ans.append(s[i])
      
if s[n-1] is not s[n-2]:
  ans.append(s[n-1])


print(len(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
l =[s[0]]
for c in s:
  if c == l[-1]:
    l.append(c)
print(len(l))

Submission status: Wrong Answer

Solution code:
while True:
    n = input()
    s = input()
    n = int(n)
    if(n==len(s)):
         break
    else:
        print("error")

d  = ''

for i in range(0,len(s)-1):
    if s[i]!=s[i+1]:
        d+=s[i]

d += s[len(s)-1]
print(d)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
import itertools

def main():
    input()
    print(len(tuple(itertools.groupby(input()))))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(input())

for x in range(n-1):
    if s[x] == s[x+1]:
        s[x] = 0

print([i for i in s if i != 0])

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(input())

l = []

for x in range(n-1):
  if s[x] == s[x+1]:
    continue
  else:
    l.append(s[x])

if s[n-1] != s[n-2]:
  l.append(s[n-1])

if len(l) == 0:
  l.append(s[0])
    
print(len(l))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(input())

i = 0
while i<len(s)-1:
  if s[i] == s[i+1]:
    del s[i]
  else:
    i += 1
print("".join(s))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(input())

i = 0
while i<len(s)-1:
  if s[i] == s[i+1]:
    del s[i]
  else:
    i += 1
print(s)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(input())
print(S)
count = 1
for i in range(N):
    if i == 0:
        continue
    elif S[i-1] != S[i]:
        count += 1

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
print(sum([1 if S[i] == S[i - 1] else 0 for i in range(1, N)]))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
ans = 0
if len(set(s)) == 1:
    print(1)
else:
    for i in range(n-1):
        if s[i] != s[i+1]:
            ans += 1
            if i == n-2:
                ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
output=''
for i in range(n-1):
  if s[i]!=s[i+1]:
    output+=s[i]
print(output)

Submission status: Wrong Answer

Solution code:
N = int(input())
X = input()
S = []
for a in range(N):
    S.append(X[a])

if N == 1:
    print(1)
else:
    for i in range(1,N):
        if S[i] != S[i-1]:
            continue
        else:
            S[i-1] = 'X'

lista = [k for k in S if k != 'X']
b = ''.join(lista)
print(len(b))

Submission status: Wrong Answer

Solution code:
N = int(input())
X = input()
S = []
for a in range(N):
    S.append(X[a])

if N == 1:
    print(X)
else:
    for i in range(1,N):
        if S[i] != S[i-1]:
            continue
        else:
            S[i-1] = 'X'
        
lista = [k for k in S if k != 'X']
print(''.join(lista))

Submission status: Wrong Answer

Solution code:
N = int(input())
X = input()
S = []
for a in range(N):
    S.append(X[a])

if N == 1:
    print(X)
else:
    for i in range(N-1):
        if S[i] == 'X':
            continue
        elif S[i] != S[i+1]:
            continue
        else:
            for m in range(i+1,N):
                if S[i] != S[m]:
                    break
            for l in range(i+1,m):
                S[l] = 'X'


lista = [k for k in S if k != 'X']
print(''.join(lista))

Submission status: Wrong Answer

Solution code:
N = int(input())
X = input()
S = []
for a in range(N):
    S.append(X[a])

if N == 1:
    print(X)
else:
    for i in range(N-1):
        if S[i] == 'X':
            continue
        elif S[i] != S[i+1]:
            continue
        else:
            for m in range(i+1,N):
                if S[i] != S[m]:
                    break
            for l in range(i+1,m+1):
                S[l] = 'X'


lista = [k for k in S if k != 'X']
print(''.join(lista))

Submission status: Wrong Answer

Solution code:
total = input()
slimes = list(input())

pre = ""
last = []

for i in slimes:
    if pre != i:
        last.append(i)
    pre = i
    print(pre)

print(len(last))

Submission status: Wrong Answer

Solution code:
s = input()
checks = s[0]
ans = 1
for c in list(s):
  if c != checks:
    checks = c
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
checks = s[0]
ans = 1
for c in s:
  if c != checks:
    checks = c
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
_ = input()
s = input()
place_holder = s[0]
count = 1
for letter in s[1:]:
  if place_holder == letter:
    continue
  else:
    place_holder = letter
    count += 1

Submission status: Wrong Answer

Solution code:
n=int(input())
S=input()

ans=[]
result=0
for i in range(n):
  if ans != S[i]:
    result+=1
    p = S[i]
print(result)

Submission status: Wrong Answer

Solution code:
n=int(input())
S=input()

ans=[]
result=len(S)
for i in range(n):
  if ans == S[i]:
    result-=1
    p = S[i]
print(result)

Submission status: Wrong Answer

Solution code:
N,S=open(0);print(sum(1for a,b in zip("0"+S,S)if a!=b))

Submission status: Wrong Answer

Solution code:
_,S=open(0);print(sum(1for a,b in zip("0"+S,S)if a!=b))

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(input())
new_S = ''

for s1,s2 in zip([0]+S,S):
  if s1 != s2:
    new_S += s2

print(new_S)

Submission status: Wrong Answer

Solution code:
n = int(input())
k = list(input())

out = k[0]
for i in range(1,n):
    if k[i-1] != k[i]:
        out += k[i]
print(out)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()

ans = 0
tmp = S[0]
for s in S:
    if s != tmp:
        ans += 1

if ans == 0:
    print(1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:

N = input()
S = list(input())

s = list(set(S))
print(len(s))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(input())
ans = 0

for i in range(n-1):
  if a[i] == a[i+1]:
    ans +=1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
str = input()
slim = [str[0]]
for i in range(n):
  if str[i] == slim[-1]:
  	slim.append(str[i]) 
  
print(len(slim))

Submission status: Wrong Answer

Solution code:
A=int(input())
B=input()
C=[]
for i in range(len(B)-1):
  if B[i]==B[i+1]:
    C.append(i+1)
print(len(C))

Submission status: Wrong Answer

Solution code:
### C - Slimes ###

N = int(input())
S = input()

#N = 10
#S = 'aabbbbaaca'
S = [i for i in S]

T = 0
while len(S) != T:
    T = len(S)
    for i in range(0, len(S)-1 ):
        if S[i] == S[i+1]:
            S.pop(i)
            break

print(''.join(S))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(str(input()))
a = ''
ans = 0
for i in s:
  if s != a:
    a = s
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
colors = list(input())
before = ""
ans = 0
for color in colors:
  if color != before:
    ans += 1
  else:
    before = color
print(ans)