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: Accepted

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

c = 1
mae = s[0]
for i in range(1,n):
    if mae == s[i]:
        continue
    else:
        mae = s[i]
        c += 1
print(c)

Submission status: Accepted

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

print(count+1)

Submission status: Accepted

Solution code:
from itertools import groupby
N = int(input())
S = input()
ans = len(list(groupby(S)))
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math

n = getN()

s = input().strip()

ans = 0
tmp =  "_"
for c in s:
    if tmp != c:
        ans += 1

    tmp = c

print(ans)

Submission status: Accepted

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

main()

Submission status: Accepted

Solution code:
def ranlength(A):
    num = list(A)
    count = 1
    result = ''
    table = []
    for i in range(len(num)):
        try:
            if num[i] == num[i+1]:
               count = count + 1
            else:
                result += str(num[i]) + str(count)
                table.append(count)
                count = 1
        except:
            result += str(num[i]) + str(count)
            table.append(count)
    return(table)

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

print(len(ranlength(S)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import sys
#input = sys.stdin.readline
def solve():
  n = int(input())
  s = input()
  ans = 0
  for i in range(n-1):
    if s[i] != s[i+1]:
      ans += 1
  ans += 1
  print(ans)
  
solve()

Submission status: Accepted

Solution code:
from itertools import groupby

n = int(input())
s = input()
print(len(list(groupby(s))))

Submission status: Runtime Error

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

c=0


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

if a[-1]!=a[-2]:
    c+=1

if c==0:
    c+=1
    
print(c)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import bisect

n = int(input())
l = sorted(list(map(int, input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l, l[i]+l[j]) - (j+1)
        #print(l,i,j,bisect.bisect_left(l, l[i]+l[j]))
print(ans)

Submission status: Runtime Error

Solution code:
x=int(input())
s=list(input())
su=s
for i in range(len(s)-1):
    if s[i]==s[i+1]:
        su.pop(i)
    else:
        pass
print(len(su))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
s = str(input())
s += "A"
q = s[0]
ans = 0
for i in range(n+1):
  if(q==s[i]):
    None:
  else:
    ans += 1
    q = s[i]
print(ans)

Submission status: Runtime Error

Solution code:
n  =int(input())
D = list(map(int,input().split()))
ans = 0
for i in range(n):
    for j in range(i+1,n):
        ans += D[i]*D[j]
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n=int(input())
s=input()
ans=n
for i in range(1,n):
    if s[i]==s[i-1]:
        ans-=1c
print(ans)

Submission status: Runtime Error

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+1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

a = []

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

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

if len(a) == 0:
    print(1)
else:
    print(len(a))

Submission status: Runtime Error

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: Runtime Error

Solution code:
N=int(input())
S=list(input())
if S[0] == S[1]:
  S[0]==" "
for i in range(2,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: Runtime Error

Solution code:
N=int(input())
S=list(input())
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: Runtime Error

Solution code:
def main():
    N = input_int()
    S = input()

    print(len(rec(S)))


def rec(s):
    if len(s) <= 1:
        return s

    i = 0

    while i + 1 in range(len(s)) and s[i] == s[i+1]:
        i += 1

    return s[0] + rec(s[i+1:])


def input_int():
    return int(input())


def input_int_tuple():
    return map(int, input().split())


def input_int_list():
    return list(map(int, input().split()))


main()

Submission status: Runtime Error

Solution code:
def main():
    N = input_int()
    S = input()

    print(len(rec(S)))
    print(rec(S))


def rec(s):
    if len(s) <= 1:
        return s

    i = 0

    while i + 1 in range(len(s)) and s[i] == s[i+1]:
        i += 1

    return s[0] + rec(s[i+1:])


def input_int():
    return int(input())


def input_int_tuple():
    return map(int, input().split())


def input_int_list():
    return list(map(int, input().split()))


main()

Submission status: Runtime Error

Solution code:
N = int(input())
#print(N)

S = input()

count = 0
for i in range(N):
    #print(S[i] , i)
    if i == 0:
        if S[i+1] != S[i]:
            count += 1
    elif i == N-1:
        if S[i-1] != S[i]:
            count += 1
    else:
        if S[i+1] != S[i]:
            count += 1

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

Submission status: Runtime Error

Solution code:
n= input()
s = input()
G = groupby(s)

print(len(list(G)))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

print(count)

Submission status: Runtime Error

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

t = []
for i in range(1, len(s)):
    if s[i] == s[i - 1]:
        continue
    else:
        t.append(s[i - 1])
t.append(s[i])
print(len(t))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
t=input()
ans=t[0]
for i in range(1,n):
    if ans[-1]==i:
        pass
    else:
        ans=ans+i
print(len(ans))

Submission status: Runtime Error

Solution code:
n,s = int(raw_input()), raw_input()
i,j,count = 0,0,0
while(j < n):
	while(j < n and s[i] == s[j]):
		j+=1
    i = j
    count +=1
print count

Submission status: Runtime Error

Solution code:
n,s = int(raw_input()), raw_input()
i,j = 0,0
while(j < n):
	while(j < n and s[i] == s[j]):
		j+=1
    i = j
    count +=1
print count

Submission status: Runtime Error

Solution code:
n,s = int(raw_input()), raw_input()
i = 0
while(j < n):
	while(j < n and s[i] == s[j]):
		j+=1
    i = j
    count +=1
print count

Submission status: Runtime Error

Solution code:
n=int(input())
n=int(input())
s=input()
l=[]

for i in range(n):
    if i==0 or l[-1]!=s[i]:
        l.append(s[i])
print(len(l))

Submission status: Runtime Error

Solution code:
n = int(input())
s = input().split("")

s = list(set(s))

print(len(s))

Submission status: Runtime Error

Solution code:
n = int(input())
s = str(input())
slist = []
for i in range(n):
  slist.append(s[i])
slime = slist[0]
fslist = [slime]
for i in range(1, n):
  if slime != slist[i]:
    fslist.append(slist[i])
    slime = slist[i]
print(len(fslist)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# C - Slimes

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

def f(s):
    n = len(s)
    for i in range(n - 1):
        if s[i] == s[i + 1]:
            s = f(s[:i] + s[i + 1:])
            break
    return s

print(len(f(S)))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    N=int(input())
    A=list(input())
    gr = groupby(A)
    cnt=0
    for key, group in gr: # groupはイテレータ。list(group)でリスト化  
        """ex.
        0: [0, 0, 0]
        1: [1, 1]
        0: [0, 0, 0]
        1: [1, 1]
        0: [0]
        1: [1]
        """
        cnt+=1
    print(cnt)
        

    
resolve()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(map(str, input().split()))
def pl(a): print(" ".join(list(map(str, a))))
def ma():return map(int,input().split())
from collections import accumulate as acc
import operator as op
import copy as cp
import math 

n=ri()
s=input()
cnt=n
if n==1:
  print(1)
  
else:
  for i in range(n-1):
    if s[i]==s[i+1]:
      cnt-=1
  print(cnt)

Submission status: Runtime Error

Solution code:
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(map(str, input().split()))
def pl(a): print(" ".join(list(map(str, a))))
def ma():return map(int,input().split())
from collections import accumulate as acc
import operator as op
import copy as cp
import math 

n=ri()
s=input()
cnt=n
if n==1:
  print(1)
  
else:
  for i in range(n-1):
    if s[i]==s[i+1]:
      cnt-=1
  print(cnt)

Submission status: Runtime Error

Solution code:
from itertools import groupby
N = int(input())
S = input()
G = groupby(S)
print(len(G))

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int n,count=1; cin>>n;
 char s[n]; for(int i=0;i<n;i++)cin>>s[i];
  
  for(int i=0;i<n-1;i++){
  
  if (s[i] != s[i+1]) {count++;}
    
  }
  
  cout<<count;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

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

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

Submission status: Runtime Error

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

s = S[0]
i = 1
ans = 1
while(True):
    if s == S[i]:
        pass
    else:
        ans += 1
        s = S[i]
    i += 1
    if i == len(S):
        break
        
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = int(input())
S = list(input())
 
length = 1
i = 0
while i < N-1:
  if S[i] == S[i+1]:
    i += 1
  else:
    lendth += 1
    i += 1
    
print(length)

Submission status: Runtime Error

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

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

if S[-2] != S[-1]:
    sumx += 2
elif S[-2] == S[-1]:
    sumx += 1

print(sumx)

Submission status: Runtime Error

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

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

if S[-2] != S[-1]:
    newS.append(S[-2])
    newS.append(S[-1])
elif S[-2] == S[-1]:
    newS.append(S[-2])
print(len(newS))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
ans = 0
pre_s = ''
for s in S:
    if s == pre_s:
        continue
    else:
        pre_s = s
        ans += 1
print(ans)

Submission status: Runtime Error

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

num = 1
ans = 1
for i in S:
    if i == S[num]:
        continue
    else:
        ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
def fusion(xs):
    if len(xs) < 2:
        yield from xs
    elif xs[0] == xs[1]:
        yield from fusion(xs[1:])
    else:
        yield xs[0]
        yield from fusion(xs[1:])


N = input()
S = input()
print(sum(1 for _ in fusion(S)))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def slime(slist,t):
    if len(slist)==1:
        if len(t)==0:
            return slist[0]
        elif slist[0]==t[0]:
            return t
        else:
#            t.append(slist[0])
            t.insert(0,slist[0])
        return t
    else:
        if slist[0]==slist[1]:
            del slist[0]
        else:
#            t.append(slist[0])
            t.insert(0,slist[0])
            del slist[0]
        return slime(slist,t)
        


n=int(input())
s=input()
slist=[]
t=[]

for i in range(len(s)):
    slist.append(s[i])
    
t=slime(slist,t)
print(len(t))

Submission status: Runtime Error

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 S[-1] != S[-2]:
    ans.append(S[-1])
if len(set(S)) == 1:
    ans.append(S[0])
print(len(ans))

Submission status: Runtime Error

Solution code:
N = int(input())
S = list(input())
gr = itertools.groupby(S)
ans = len([1 for key, group in gr])
print(ans)

Submission status: Runtime Error

Solution code:
#coding: utf-8
N = int(input())
S = input()
ans = 1
for i in range(1, N-1):
    if S[i-1] != S[i]:
        ans += 1
if S[-2] != S[-1]:
    ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
L = list(map(int,input().split()))
count = 0
L.sort()
for i in range(N-2):
    for j in range(i+1,N-1):
        maxi = L[i] + L[j]
        mini = abs(L[i] - L[j]) 
        for k in range(j+1,N):
            if maxi > L[k] > mini:
                count += 1 
print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
li = list(map(int, input().split()))
ans = dict()
for i in range(len(li)):
    ans[li[i]] = i + 1
ali = []
for j in sorted(ans.keys()):
    ali.append(ans[j])
print(*join(ali))

Submission status: Runtime Error

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

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

print(count+1)

Submission status: Runtime Error

Solution code:
20
xxzaffeeeeddfkkkkllq

Submission status: Runtime Error

Solution code:
n=int(input())
l=[*input()]
a=l[0]
x=n
for i in range(1,n):
    if a==l[i]:
        x-=1
    a=l[i]
print(x)

Submission status: Runtime Error

Solution code:
n = int(input())
A = list(map(int, input().split()))
result = 1
for i in range(n-1):
  if A[i]!=A[i+1]:
  	result = result + 1
print(result)

Submission status: Runtime Error

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

ans = 0

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

print(ans+1)

Submission status: Runtime Error

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

print(count)

Submission status: Runtime Error

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

before = aaa
ans = 0
for char in s:
  if char != before:
    before = char
    ans += 1
print(ans)

Submission status: Runtime Error

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

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

print(c+1)

Submission status: Runtime Error

Solution code:
N = int(input())
X = input()
S = []
for a in range(N):
    S.append(X[a])
print(S)
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:
            j = i+1
            while S[i] == S[j]:
                j += 1
            for l in range(i+1,j):
                S[l] = 'X'
print(S)

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

Submission status: Runtime Error

Solution code:
N = int(input())
X = input()
S = []
for a in range(N):
    S.append(X[a])
if N == 1:
    print(S)
else:
    
    for i in range(N-1):
        if S[i] == 'X':
            continue
        elif S[i] != S[i+1]:
            continue
        else:
            j = i+1
            while S[i] == S[j]:
                j += 1
            for l in range(i+1,j):
                S[l] = 'X'
print(S)

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

Submission status: Runtime Error

Solution code:
N = int(input())
X = input()
S = []
for a in range(N):
    S.append(X[a])
if N == 1:
    print(S)
else:
    
    for i in range(N-1):
        if S[i] != S[i+1] or S[i] == 'X':
            continue
        else:
            j = i+1
            while S[i] == S[j]:
                j += 1
            for l in range(i+1,j):
                S[l] = 'X'
lista = [k for k in S if k != 'X']
print(''.join(lista))

Submission status: Runtime Error

Solution code:
N = int(input())
X = input()
S = []
for a in range(N):
    S.append(X[a])
if N == 1:
    print(S)
else:
    
    for i in range(N-1):
        if S[i] != S[i+1] or S[i] == 'X':
            continue
        else:
            j = i+1
        while S[i] == S[j]:
            j += 1
            for l in range(i+1,j):
                S[l] = 'X'
lista = [k for k in S if k != 'X']
print(''.join(lista))

Submission status: Runtime Error

Solution code:
N = int(input())
X = input()
S = []
for a in range(N):
    S.append(X[a])
if N == 1:
    print(S)
else:
    
    for i in range(N-1):
        if S[i] != S[i+1] or S[i] == 'X':
            continue
        else:
            j = i+1
        while S[i] == S[j]:
            j += 1
            for l in range(i+1,j):
                S[l] = X
lista = [k for k in S if k != X]
print(''.join(lista))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = int(input())
S = list(input().split())
for i in range(N-1):
  if S[i] != S[i+1]:
    continue
  else:
    j = i+1
    while S[i] == S[j]:
      j += 1
    S[i:j] = 0
print([k for k in S if k != 0])

Submission status: Runtime Error

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: Runtime Error

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: Runtime Error

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

prev = S[0]:

num = 1
for s in S[1:]:
    if prev != s:
        num += 1
    prev = s

print(num)

Submission status: Runtime Error

Solution code:
x = int(input())
slime = str(input())
i = 0
scount = 0
while(i < n-1):
    if(slime[i] != slime[i+1]):
        scount += 1
    i += 1
print(scount)

Submission status: Runtime Error

Solution code:
input1 = input()
input2 = input()
#input1 = "5"
#input2 = "abccd"
N = int(input1)
hairetu = list(input2)

i=0
s=0
a=0

for s in range (i,N-2):
    if hairetu[s]==hairetu[s+1]:
        for n in range (s,N-s):
            hairetu[n]=hairetu[n+1]
            N=N-1
        a = hairetu.pop(n)
p = len(hairetu)
print(p)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

S = list(input())

def independent(S):
    if len(S) == 1:
        return True
    else:
        for i in range(len(S) - 1):
            if S[i] == S[i+1]:
                flag = 0
                break
            else:
                flag = 1
        if flag == 1:
            return True
        else:
            return False
                
i = 0
while independent(S) == False:
    if i == len(S) - 1:
        i = 0
    if S[i] == S[i+1]:
        S.pop(i)
    i += 1

print(len(S))

Submission status: Runtime Error

Solution code:
n = int(input())
s = input()
res = ""
x = ""
for l in s:
  if i != x:
    x = l
    res += x
  else: pass
print(len(res))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

rslt = [S[0]]
S = [i for i in S[1:]]

for i in S:
    if rslt[-1] != i:
        rslt.extend(i)

len(rslt)'abcd'[-1]

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(N - cnt)

Submission status: Runtime Error

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

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

ret = N - cnt

print(ret)

Submission status: Runtime Error

Solution code:
N = int(inpu
S = input()
cnt = 0
for i in ran
  if S[i-1] 
    cnt += 1

print(cnt+1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
s=list(input().split())
sum=0
i=1
str=s[0]
while i<=n-1:
  if str == s[i]:
    continue
  else:
    str=s[i]
    sum+=1
print(sum)

Submission status: Runtime Error

Solution code:
num=int(input())
data=list(input())
 
count=1
for i in range(num-1):
  if data[i]=!data[i+1]:
    count+=1
print(count)

Submission status: Runtime Error

Solution code:
num=input()
data=list(input())

count=1
for i in range(num-1):
  if data[i]=!data[i+1]:
    count+=1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import itertools
N = input()
S = input()

count = 0

gr = itertools.groupby(s)
for key, group in gr:
    # print(list(group))
    count += 1
print(count)

Submission status: Runtime Error

Solution code:
import itertools

n = int(input())
l = list(map(int,input().split()))


a = list(itertools.combinations(l, 3))
b = []

for i in a:
    b.append(tuple(sorted(i)))

c = list(set(b))

count = 0

for i in c:
    if i[0] < i[1] + i[2] and i[1] < i[0] + i[2] and i[2] < i[0] + i[1]:
        count += 1

print(count)

Submission status: Runtime Error

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

for i in range(N):
  if S[i]==S[i+1]:
    continue
  else:
    cnt+=1
print(cnt)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

print(cnt)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
s=list(map(int,input().split()))
x=0
for i in range(0,n-1):
  if s[i]=s[i+1]:
    x+=1
print(n-x)

Submission status: Runtime Error

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

k=""
for i in range(1,N):
  if S[i-1] != S[i]:
    k += S[i-1]
if S[-2] != S[-1]:
  k += S[-1]

if len(k)==0:
  print(1)
else:
  print(len(k))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
str = string(input())
count=0
for i in range(n):
    if str[i] != str[i+1]:
        count+=1
print(count)

Submission status: Runtime Error

Solution code:
n = int(input())

str = string(input())
count=0
for i in range(n):
    if str[i] != str[i+1]:
        count+=1
return count

Submission status: Runtime Error

Solution code:
n = int(input())
str = string(input())
count=0
for i in range(n):
    if str[i] != str[i+1]:
        count+=1
return count

Submission status: Runtime Error

Solution code:
N=int(input())
li = input().split()	

tmp='0'
cnt=0

for i in range(N):
	if li[i]!=tmp:
    	cnt+=1
        tmp=li[i]
print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = int(input())
e = input()
a = [str(c) for c in e]
for i in range(0,s):
  for j in range(i+1,s):
    if(a[i]==a[j]):
      a.pop(j)
print(a)

Submission status: Runtime Error

Solution code:
a=int(input())
string=[]
con=-1
t=0
for i in range(a):
    x=input()
    string.append(x)

for i in range(a):
    if string[i]==string[t]:
        continue
    else:
        t+=1
        con+=1
print(con)

Submission status: Runtime Error

Solution code:
a=int(input())
string=[]
con=-1
t=0
for i in range(a):
    x=input()
    string.append(x)
print(string)

for i in range(a):
    if string[i]==string[t]:
        continue
    else:
        t+=1
        con+=1
print(con)

Submission status: Runtime Error

Solution code:
a=int(input())
string=[]
con=0
t=1
for i in range(a):
    x=input()
    string.append(x)
print(string)

for i in range(a):
    if string[i]==string[t]:
        continue
    else:
        t+=1
        con+=1
print(con)