TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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?

Submission attempts (in order):
N = int(input())
S = list(input().split())
d = S[0]

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

N = int(input())
S = input().split()
d = S[0]

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

N = int(input())
S = list(input().split())
d = S[0]

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

N = int(input())
S = input()
d = S[0]

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

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

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

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

Verdicts: Runtime Error

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

Submission attempts (in order):
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)

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

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

Verdicts: Runtime Error

Wrong Answer

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

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

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
a = input()
b = ''
for i in range(n):
  if b[-1] != i:
    b += i
print(len(b))


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

Verdicts: Runtime Error

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

Submission attempts (in order):
_ = 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

_ = 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

_ = 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

_ = 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
print(count)


Verdicts: Runtime Error

Runtime Error

Wrong Answer

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

Submission attempts (in order):
n = int(input())
data = list(input().rstrip())
cnt = 0

if data.count(data[0]) == n:
	print(1)
	exit()

for i in range(0,len(data)):
	cnt = 0
	for j in range(i+1,len(data)):
		if data[i] == data[j]:
			cnt += 1
		else:
			break
	if cnt >= 1:
		print(i+1,j,data)
		del data[i+1:j]
print(len(data))
print(data)

n = int(input())
data = list(input().rstrip())
ans = [data[0]]
cnt = 0
i = 0

for _ in range(n):
  if ans[-1] != data[i]:
    ans.append(data[i])
  i += 1
    
print(len(ans))

Verdicts: Runtime Error

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

Submission attempts (in order):
n = int(input())
s = input()

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

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

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
### C - Slimes ###

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

#N = 10

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


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]

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)

print(len(rslt))

Verdicts: Wrong Answer

Runtime Error

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

Submission attempts (in order):
N = int(input())
S = input()

prev = S[0]:

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

print(num)

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

prev = S[0]

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

print(num)

Verdicts: Runtime Error

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

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

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

Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
A = list(input())
print(A)
ans = 1
for i in range(N-1):
  if A[i] == A[i+1]:
    continue
  else:
    ans +=1
    
print(ans)

N = int(input())
A = list(input())

ans = 1
for i in range(N-1):
  if A[i] == A[i+1]:
    continue
  else:
    ans +=1
    
print(ans)

Verdicts: Wrong Answer

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

Submission attempts (in order):
import sys
input = sys.stdin.readline
 
N = int(input())
s= list(input())
 
s0 = s.pop()
 
cnt = 1
 
while s:
    s1 = s.pop()
    if s1!=s0:
        cnt += 1
        s0 = s1
print(cnt)

import sys
input = sys.stdin.readline

N = int(input())
s= list(input())

s0 = s.pop()

cnt = 1

while s:
    s1 = s.pop()
    if s1!=s0:
        cnt += 1
        s0 = s1
print(cnt)

import sys
input = sys.stdin.readline

N = int(input())
s= list(input())

s0 = s.pop()

cnt = 1

while s:
    s1 = s.pop()
    if s1!=s0:
        cnt += 1
        s0 = s1
print(cnt)


#import sys
#input = sys.stdin.readline
 
N = int(input())
s= list(input())
 
s0 = s.pop()
 
cnt = 1
 
while s:
    s1 = s.pop()
    if s1!=s0:
        cnt += 1
        s0 = s1
print(cnt)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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

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

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

Verdicts: Runtime Error

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

Submission attempts (in order):
from collections import OrderedDict

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

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

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

check = 0

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
s = input()
s_list = list(s)
count = 0
for i in range(n):
    while s_list[i] != s_list[i+1]:
        count += 1
output = count+1
print(output)

n = int(input())
s_list = list(input())
count = 0
for i in range(n-1):
    if s_list[i] != s_list[i+1]:
        count += 1
output = count+1
print(output)


Verdicts: Runtime Error

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

Submission attempts (in order):
le = int(input())
lis = list(input())
alis = []
def delete(n,lis):
    for i in range(n):
        if i==n-1 or lis[i] != lis[i-1]  :
            alis.append(lis[i])
delete(le,lis)
print(len(alis))


le = int(input())
lis = list(input())
alis = []
def delete(n,lis):
    for i in range(n):
        if i==n-1 or lis[i] != lis[i+1]  :
            alis.append(lis[i])
delete(le,lis)
print(len(alis))


Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
L = list(map(int,input().split()))

ans = 0

for i in range(N-2):
  for j in range((i+1),N-1):
    for k in range((j+1),N):
      print("i=",i)
      print("j=",j)
      print("k=",k)
      if L[i] < L[j] + L[k] and L[j] < L[i] + L[k] and L[k] < L[j] + L[i]:
        ans += 1
          

    
print(ans)



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

ans = 1

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


Verdicts: Runtime Error

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

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

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

Verdicts: Runtime Error

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

Submission attempts (in order):
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)

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

Verdicts: Runtime Error

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

Submission attempts (in order):
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)

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

Verdicts: Runtime Error

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

Submission attempts (in order):
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))

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)

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

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

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
import sys
input = sys.stdin.readline
import itertools

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

if __name__ == '__main__':
    main()


import sys
input = sys.stdin.readline
import itertools

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

if __name__ == '__main__':
    main()


import sys
input = sys.stdin.readline
import itertools

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

if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
n = int(input())
s = input()
after_fusion = []

current = ''
for i in range(n):
    if s[i] != current:
        after_fusion.append(s[i])
        current = s[i]

print(len(after_fusion)

n = int(input())
s = input()
after_fusion = []

current = ''
for i in range(n):
    if s[i] != current:
        after_fusion.append(s[i])
        current = s[i]

print(len(after_fusion))

Verdicts: Runtime Error

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

Submission attempts (in order):
n = int(input())
s = input()
i = 0
while i < n - 1:
  s = s[i]
  if s[i + 1]:
    while s == s[i + 1]:
      s.pop(i + 1)
      n -= 1
  i += 1
print(n)

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

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

n = int(input())
s = input()
slimes = s.split("")
i = 0
while i < n - 1:
  s = slimes[i]
  while s == slimes[i + 1]:
    slimes.pop(i + 1)
    n -= 1
  i += 1
print(n)

n = int(input())
s = input()
i = 0
while i < n - 1:
  while s[i] == s[i + 1]:
    s.pop(i + 1)
    n -= 1
  i += 1
print(n)


n = int(input())
s = input()
slimes = s.split("")
i = 0
while i < n - 1:
  s = slimes[i]
  while s == slimes[i + 1]:
    slimes.pop(i + 1)
    n -= 1
  i += 1
print n

n = int(input())
s = input()
slimes = s.split("")
i = 0
while i < n - 1:
  s = slimes[i]
  while s == slimes[i + 1]:
    slimes.pop(i + 1)
    n -= 1
  i += 1
print(str(n))

n = int(input())
s = input()
slimes = list(s.split(''))
i = 0
while i < n - 1:
  s = slimes[i]
  while s == slimes[i + 1]:
    del slimes[i + 1]
    n -= 1
  i += 1
print n

n = int(input())
s = input()
i = 0
while i < n - 1:
  if s[i + 1]:
  while s[i] == s[i + 1]:
    s.pop(i + 1)
    n -= 1
  i += 1
print(n)


n = int(input())
s = input()
i = 0
while i < n - 1:
  while s[i] == s[i + 1]:
    s.pop(i + 1)
    n -= 1
  i += 1
print(n)


n = int(input())
s = input()
i = 0
while i < n - 1:
  
  while s[i + 1] and s[i] == s[i + 1]:
    s.pop(i + 1)
    n -= 1
  i += 1
print(n)


n = int(input())
s = input()
slimes = s.split("")
i = 0
while i < n - 1:
  s = slimes[i]
  while s == slimes[i + 1]:
    del slimes[i + 1]
    n -= 1
  i += 1
print n

n = int(input())
s = input()
slimes = s.split("")
i = 0
while i < n - 1:
  s = slimes[i]
  while s == slimes[i+1]:
    del slimes[i+1]
    n -= 1
  i += 1
print n

import sys

n, s = sys.stdin.read().split()

def main():
    cnt = 0
    prev = '$'
    for c in s:
        if c == prev: continue
        cnt += 1
        prev = c
    print(cnt)

if __name__ ==  '__main__':
    main()

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

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

Submission attempts (in order):
from itertools import groupby

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

print(len(groupby(S)))

from itertools import groupby

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

print(sum(1 for k, _ in groupby(S)))

Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
S = list(input().split())

ans = 1
for i in range(N):
    if i != i + 1:
        ans = ans + 1
print(ans)

N = int(input())
S = list(input().split())
 
ans = 1
for i in range(N - 1):
    if S[i] != S[i + 1]:
        ans = ans + 1
print(ans)

N = int(input())
S = list(input().split())
 
ans = 1
for i in range(N - 1):
    if i != i + 1:
        ans = ans + 1
print(ans)

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

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

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

Submission attempts (in order):
n = int(input())
color = input()
print(color)
while(True):
    for i in range(len(color)-1): 
        if color[i]==color[i+1]:
            color = color[:i] + color[(i+1):]
            break
        else:
            pass
    else:
        break
print(len(color))

n = int(input())
color = str(input())
count=1
for i in range(len(color)-1): 
    if color[i]!=color[i+1]:
        count += 1
    else:
            pass
print(count)

Verdicts: Wrong Answer

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

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

n = int(input())
a = list(input())
b =[a[0]]
for i in a:
  if i !=b[-1]:
    b.append(i)
print(len(b))

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
S = input()
List_S = list(S)
Ans = 1

print(List_S)

for i in range(N-1):
    if List_S[i] != List_S[i+1]:
        Ans += 1
    
print(Ans)

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

List_S = list(S)
Ans = 1

for i in range(N-1):
    if List_S[i] != List_S[i+1]:
        Ans += 1
    
print(Ans)

Verdicts: Wrong Answer

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

Submission attempts (in order):
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)

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

print(len(run_length(S)))

Verdicts: Wrong Answer

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

Submission attempts (in order):
N=int(input())
S=input()
S_list=[]
for i in S:
    S_list.append(i)
set(S_list)
print(lens(S_list))


N=int(input())
S=input()
S_list=[]
count = 0
j=''

for i in S:
    count +=1
    if (count>=2) & (i==j): continue
    else:
        S_list.append(i)
        j=i

print(len(S_list))



Verdicts: Runtime Error

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

Submission attempts (in order):
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)


input1 = input()
input2 = input()
#input1 = "20"
#input2 = "xxzaffeeeeddfkkkkllq"
N = int(input1)
hairetu = list(input2)

i=0
s=0
a=0

for s in range (N*N):
    if len(hairetu)<i+2:
        break
    elif hairetu[i]==hairetu[i+1]:
        a = hairetu.pop(i+1)
    else:
        i=i+1

    
p = len(hairetu)
print(p)

Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
s = input()
cnt = 0
for i in range(1,N):
  if s[i] != s[i-1]:
    cnt += 1
print(cnt)


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

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
Slime = list(input())
check = 'st'
res = 0

for i in range(N-1):
	if Slime[i+1] != check:
		check = Slime[i+1]
		res += 1
res += 1

print(res)

N = int(input())
Slime = list(input())
check = Slime[0]
res = 0

for i in range(N-1):
	if Slime[i+1] != check:
		check = Slime[i+1]
		res += 1
res += 1

print(res)

Verdicts: Wrong Answer

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

Submission attempts (in order):

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

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



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

data = 0

for i in range(N):
    if data == S[i]:
        S[i] = 0

    else:
        data = S[i]

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


Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
s = list(input())
c = 1
for i in range(n):
    print(i)
    if i+1 == n:
        break
    if s[i] != s[i+1]:
        c += 1
print(c)


n = int(input())
s = list(input())
c = 1
for i in range(n):
    if i+1 == n:
        break
    if s[i] != s[i+1]:
        c += 1
print(c)

Verdicts: Wrong Answer

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

Submission attempts (in order):
def main():
    baselist=[]
    anslist=[]
    baseword = input()
    [baselist.append(i) for i in baseword]
    for index,value in enumerate(baselist):
        if int(index+1)<int(len(baselist)):
            if baselist[index]!=baselist[index+1]:
                anslist.append(baselist[index])
        else:
            anslist.append(baselist[index])
    print(len(anslist))

if __name__ == "__main__":
    main()

def main():
    baselist=[]
    anslist=[]
    N = input()
    baseword = input().rstrip()
    [baselist.append(i) for i in baseword]
    for index,value in enumerate(baselist):
        if int(index+1)<int(len(baselist)):
            if baselist[index]!=baselist[index+1]:
                anslist.append(baselist[index])
        else:
            anslist.append(baselist[index])
    print(len(anslist))

if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

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

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

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


Verdicts: Runtime Error

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

Submission attempts (in order):
N=int(input())
S=list(input())
print(S)
for i in range(N-1):
    if S[i]==S[i+1]:
        S[i]='0'
S = [i for i in S if i != '0']
print(len(S))


N=int(input())
S=list(input())
for i in range(N-1):
    if S[i]==S[i+1]:
        S[i]='0'
S = [i for i in S if i != '0']
print(len(S))


Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
s = input()
a = 1
for i in range(n-1):
  if s[i] != s[i+1]:
    a += 1

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
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)


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

Verdicts: Runtime Error

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

Submission attempts (in order):
import itertools
n = input()
s = input()

ans = [[k, len(list(g))] for k, g in itertools.groupby(s)]
len(ans)

import itertools
n = input()
s = input()

ans = [[k, len(list(g))] for k, g in itertools.groupby(s)]
print(len(ans))

Verdicts: Wrong Answer

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

Submission attempts (in order):
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)




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)



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)


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

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



Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

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

Submission attempts (in order):
n = int(input())
str = input()

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

n = int(input())
str =list(input())
count = 1
for i in range(n-1):
  if str[i] != str[i + 1]:
    count += 1
    
    
print(count)

Verdicts: Runtime Error

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

Submission attempts (in order):
n = int(input())
s = input()

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

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

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
S = input()
ans=0
for i in range(1,N):
    if S[i]!=S[i-1]
        ans+=1
print(ans+1)

N = int(input())
S = input()
print(len(set(S)))

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

Verdicts: Runtime Error

Wrong Answer

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

Submission attempts (in order):
N=int(input())
slimes = []
slimes.append(input())
lastColor = slimes[0]
for i in range(N-1):
	new_slime = input()
	if not lastColor == new_slime:
    	slimes.append(new_slime)
print(slimes.length())

N=int(input())
slimes = []
all_slime=input()
slimes.append(all_slime[0])
lastColor = all_slime[0]
for i in range(1,N):
    new_slime = all_slime[i]
    if not lastColor == new_slime:
        slimes.append(new_slime)
    lastColor=new_slime
print(len(slimes))

Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
c = [int(x) for x in input().split()]

a = N

for i in N - 2:
  if c[i]==c[i+1]:
    a -= 1

print(a)

N = int(input())
c = [str(x) for x in input()]

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

Verdicts: Runtime Error

Accepted