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

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
S=list(input())
check=[]
for i in range(N-1):
  if S[i]==S[i+1]:
    check.append(i)
reversed(check)
for i in check:
  S.pop(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main(n,s):
    if n == 1:
        return 1
        
    count = 1
    for i in range(1,n):
        if s[i] != s[i-1]:
            print(s[i] + s[i-1])
            count += 1
    return count

inp = input().split()
n = int(inp[0])
s = inp[1]


print(main(n,s))

Submission status: Runtime Error

Solution code:
def main(n,s):
    if n == 1:
        return 1
        
    count = 1
    for i in range(1,n):
        if s[i] != s[i-1]:
            print(s[i] + s[i-1])
            count += 1
    return count

inp = input().split("\n")
n = int(inp[0])
s = inp[1]


print(main(n,s))

Submission status: Runtime Error

Solution code:
def main(n,s):
    if n == 1:
        return 1
        
    count = 1
    for i in range(1,n):
        if s[i] != s[i-1]:
            count += 1
    return count

inp = input().split()
n = int(inp[0])
s = inp[1]


print(main(n,s))

Submission status: Runtime Error

Solution code:
def main(n,s):
    if n == 1:
        return 1
        
    count = 1
    for i in range(1,n):
        if s[i] != s[i-1]:
            count += 1
    return count

inp = input().split("\n")
n = int(inp[0])
s = inp[1]


print(main(n,s))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n = int(input())
    s = input()
    ans = 1

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

if __name__ == '__main__':
    main()
v

Submission status: Runtime Error

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


def jokyolist(s):
  jokyo=[]
  #jokyo配列はこれから除去すべき奴の番号のリスト
  for i in range(len(s)-1):
    if s[i]==s[i+1]:
      jokyo.append(i)
    jokyo=sorted(jokyo,reverse=TRUE)
  return jokyo

def remov(s,jokyo):
  for i in range(len(jokyo)):
    s.pop(jokyo[i])
    return s
def removtimes(jokyo):
  t=len(jokyo)
  return t


while:
  jokyo=jokyolist(s)
  if removtimes(jokyo)==0:
    break:
  s=remov(s,jokyo)

print(len(s))

Submission status: Runtime Error

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

b = ''
b += b + s[0]

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

print(b)

Submission status: Runtime Error

Solution code:
N = int(input())
l = list(input())
h = []
for i, s in enumerate(l):
    if i + 1 == N:
        h.append(s)
        print(len(h))
    if s != l[i + 1]:
        h.append(s)

Submission status: Runtime Error

Solution code:
length = int(input())
li = list(input())
li2 = []
i = 0
for str in li[:]:
    i = 1 + i
    if i + 1 == len(li):
        li2.append(li[i])
        print(len(li2))
        break
    if li[i] != li[i + 1]:
        li2.append(li[i])
        continue

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n= input()
s = input()
slist =  [s[i:i + 1] for i in range(0, len(s),)]
length = len(slist)

for i in range(0, length-2):
    if  slist[i] == slist[i + 1]:
        slist.remove(slist[i])

print(len(slist))

Submission status: Runtime Error

Solution code:
n= input()
s = input()
slist =  [s[i:i + 1] for i in range(0, len(s),)]
length = len(slist)

for i in range(0, length-2):
    if  slist[i] == slist[i + 1]:
        slist.remove(slist[i])

print(slist)

Submission status: Runtime Error

Solution code:
#N = input("スライムの数 : ")
#S = input("対応する文字列 : ")
A = input("")
N = A.split("\n")[0]
S = A.split("\n")[1]
result = int(N)
for i in range(len(S) - 1):
  if S[i] == S[i + 1]:
    result -= 1
print(result)

Submission status: Runtime Error

Solution code:
#N = input("スライムの数 : ")
#S = input("対応する文字列 : ")
result = int(N)
for i in range(len(S) - 1):
  if S[i] == S[i + 1]:
    result -= 1
print(result)

Submission status: Runtime Error

Solution code:
N = input("スライムの数 : ")
S = input("対応する文字列 : ")
result = N
for i in range(len(S) - 1):
  if S[i] == S[i + 1]:
    result -= 1
print(result)

Submission status: Runtime Error

Solution code:
N = input("スライムの数 : ")
S = input("対応する文字列 : ")
result = 0
for i in len(S) - 1:
  if S[i] != S[i + 1]:
    result += 1
print(result)

Submission status: Runtime Error

Solution code:
N=int(input())
S=input()
S_list=[]
for i in S:
    S_list.append(i)
set(S_list)
print(lens(S_list))

Submission status: Runtime Error

Solution code:
number = int(input())
list = list(map(int, input().split()))
ls = sorted(list)
print(ls)
count = 0

for a in range(0, number - 2):
    num_a = ls[a]
    for b in range(a + 1, number - 1):
        num_b = ls[b]
        for c in  range(b + 1, number):
            num_c = ls[c]
            if num_a + num_b > num_c:
                count += 1

print(count)

Submission status: Runtime Error

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

print(count)

Submission status: Runtime Error

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

@tail_recursive
def fun(list,c=0):
    if len(list) == 1:
        return c+1
    if list[0] == list[1]:
        return fun(list[1:],c)
    else:
        return fun(list[1:],c+1)

print(fun(S))

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
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())

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a = input().split()
N = int(a[0])
S = a[1]
print(a, N, S)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=input()
t=''
a=1
for i in len(s)-1:
  if s[i]!=s[i+1]:
    a+=1
print(a)

Submission status: Runtime Error

Solution code:
n=int(input())
a=input().strip()
x+=a[0]
for i in range(1,n):
  if a[i]!=a[i-1]:
    x+=a[i]
print(len(x))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n=int(input())
S=str(input())
s=list(S)
i=1
while True:
    if n ==1:
        break
    if s[i-1]==s[i]:
        s.pop(i)
        n -= 1
    else:
        i +=1
    if i > n:
        break
print(len(s))

Submission status: Runtime Error

Solution code:
n=int(input())
S=str(input())
s=list(S)
i=1
while True:
    if i > n:
        break
    if s[i-1]==s[i]:
        s.pop(i)
        n -= 1
    else:
        i +=1

print(len(s))

Submission status: Runtime Error

Solution code:
n=int(input())
S=str(input())
s=list(S)
i=1
while True:
    if s[i-1]==s[i]:
        s.pop(i)
        n -= 1
    else:
        i +=1
    if i >=n:
        break
print(len(s))

Submission status: Runtime Error

Solution code:
n = int(input())
s = input()
p = list(s)
i=1
f=0
while f==0:  
    if p[i-1]==p[i]:
        del p[i]
    else:
        i+=1
    if len(p)<=i:
        f=1

print(len(p))

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
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))

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

Solution code:
import sys
args = sys.argv
print(args)
```
  num = args[0]
  slimes = args[1]

  tmp = []
  for i in range(0,len(smiles)):
    if len(tmp): 
      if slimes[i] == slimes[i+1] and slimes[i] != tmp[-1]:
          tmp.append(slimes[i])
    else:
      if slimes[i] == slimes[i+1]:
          tmp.append(slimes[i])

  print(len(tmp))    
```

Submission status: Runtime Error

Solution code:
import sys

if __name__ == "__main__":
  args = sys.argv
  print(args)
```
  num = args[0]
  slimes = args[1]

  tmp = []
  for i in range(0,len(smiles)):
    if len(tmp): 
      if slimes[i] == slimes[i+1] and slimes[i] != tmp[-1]:
          tmp.append(slimes[i])
    else:
      if slimes[i] == slimes[i+1]:
          tmp.append(slimes[i])

  print(len(tmp))    
```

Submission status: Runtime Error

Solution code:
#import sys
print("hoge")
  ``` 
if __name__ == "__main__":
  args = sys.argv
  print(args)

  num = args[0]
  slimes = args[1]

  tmp = []
  for i in range(0,len(smiles)):
    if len(tmp): 
      if slimes[i] == slimes[i+1] and slimes[i] != tmp[-1]:
          tmp.append(slimes[i])
    else:
      if slimes[i] == slimes[i+1]:
          tmp.append(slimes[i])

  print(len(tmp))    
  ```

Submission status: Runtime Error

Solution code:
import sys
print("hoge")
  ``` 
if __name__ == "__main__":
  args = sys.argv
  print(args)

  num = args[0]
  slimes = args[1]

  tmp = []
  for i in range(0,len(smiles)):
    if len(tmp): 
      if slimes[i] == slimes[i+1] and slimes[i] != tmp[-1]:
          tmp.append(slimes[i])
    else:
      if slimes[i] == slimes[i+1]:
          tmp.append(slimes[i])

  print(len(tmp))    
  ```

Submission status: Runtime Error

Solution code:
import sys

if __name__ == "__main__":
  args = sys.argv
  print(args)
  ``` 
  num = args[0]
  slimes = args[1]

  tmp = []
  for i in range(0,len(smiles)):
    if len(tmp): 
      if slimes[i] == slimes[i+1] and slimes[i] != tmp[-1]:
          tmp.append(slimes[i])
    else:
      if slimes[i] == slimes[i+1]:
          tmp.append(slimes[i])

  print(len(tmp))    
  ```

Submission status: Runtime Error

Solution code:
import sys

if __name__ == "__main__":
  args = sys.argv

  num = args[0]
  slimes = args[1]

  tmp = []
  for i in range(0,len(smiles)):
    if len(tmp): 
      if slimes[i] == slimes[i+1] and slimes[i] != tmp[-1]:
          tmp.append(slimes[i])
    else:
      if slimes[i] == slimes[i+1]:
          tmp.append(slimes[i])

  print(len(tmp))

Submission status: Runtime Error

Solution code:
import sys

args = sys.argv

num = args[0]
slimes = args[1]
if __name__ == "__main__":
  tmp = []
  for i in range(0,len(smiles)):
    if len(tmp): 
      if slimes[i] == slimes[i+1] and slimes[i] != tmp[-1]:
          tmp.append(slimes[i])
    else:
      if slimes[i] == slimes[i+1]:
          tmp.append(slimes[i])

  print(len(tmp))

Submission status: Runtime Error

Solution code:
import sys

args = sys.argv

num = args[0]
slimes = args[1]

tmp = []
for i in range(0,len(smiles)):
  if len(tmp): 
  	if slimes[i] == slimes[i+1] and slimes[i] != tmp[-1]:
  		tmp.append(slimes[i])
  else:
    if slimes[i] == slimes[i+1]:
 		tmp.append(slimes[i])

print(len(tmp))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def T():
    N=int(input())
    S=input()
    c=''
    t=0
    for s in S:
        if s==c:
            t+=1
        c=s
    return(t)
print(N-T())

Submission status: Runtime Error

Solution code:
n = int(input())
s = input()
a = list(s)
print(a)
b = 1
while b != 0:
    b = 0
    #i = 1
    #print(i)
    for i in range(1,len(a)):
        if a[i-1] == a[i]:
            del a[i]
            print(a)
            b = b + 1
            #print(b)
            break
print(len(a))

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
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))

Submission status: Runtime Error

Solution code:
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))

Submission status: Runtime Error

Solution code:
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))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = int(input())
S = input().split()
count = 1
for i in range(N-1):
    j = i+1
    if S[i] != S[j]:
        count += 1
print(count)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
a = int(input())
s = input()
i = 0
while(i<len(s)-1):
  if s[i] == s[i+1]:
    s.pop(i)
  else:
    i+=1
print(len(s))

Submission status: Runtime Error

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

i = 1
nowcolor = s[0]
while(True):
    if nowcolor == s[i]:
        del s[i]
    else:
        nowcolor = s[i]
        i += 1
    if len(s) == i:
        break
print(len(s))

Submission status: Runtime Error

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

prev = None
count = 0

for i in S:
  if prev != i:
  	prev = i
    count += 1
print(count)

Submission status: Runtime Error

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

prev = None
for i in S:
  if prev != i:
  	prev = i
    count += 1
print(count)

Submission status: Runtime Error

Solution code:
import itertools

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

comb = list(itertools.combinations(l, 3))

result = 0

for i in range(len(comb)):
    a, b, c = comb[i]
    if a < b + c:
        if b < c + a:
            if c < a + b:
                result += 1

print(result)

Submission status: Runtime Error

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

ans=N

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

print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
s=str(input())
slime_cnt=0

for i in range(n-1):
  if s[i]==s[i+1]:
    slime_cnt=slime_cnt
  if s[i]!=s[i+1]:
    slime_cnt+=1
if s[-1]==s[-2]:
  print(slime_cnt)
else:
  print(slime_cnt+1)

Submission status: Runtime Error

Solution code:
N, *D = map(int, open(0).read().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().rstrip())
s = list(input())

for i in range(n):
    
    if s[i] == s[i+1]:
        s.pop(s[i+1])
        
print(len(s))

Submission status: Runtime Error

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

iii = []
iii.append(len(S))

if N == 1:
    print(1)
    exit()

elif N == 2:
    if S[0] == S[1]:
        print(1)
        exit()
    else:
        print(2)
        exit()

def SSS():
    for i in range(0, len(S) - 2):
        if S[i] == S[i + 1]:
            del S[i]
            break
    iii.append(len(S))
    if iii[len(iii)-2] == iii[-1] or iii[-1] == 1:
        print(iii[-1])
    else:
        SSS()

SSS()

Submission status: Runtime Error

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

iii = []
iii.append(len(S))

if N == 1:
    print(1)
    exit()

elif N == 2:
    if S[0] == S[1]:
        print(1)
        exit()
    else:
        print(2)
        exit()

def SSS():
    for i in range(0, len(S) - 1):
        if S[i] == S[i + 1]:
            del S[i]
            break
    iii.append(len(S))
    if iii[len(iii)-2] == iii[-1] or iii[-1] == 1:
        print(iii[-1])
    else:
        SSS()

SSS()

Submission status: Runtime Error

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

iii = []
iii.append(len(S))

if N == 1:
    print(1)
    exit()

elif N == 2:
    if S[0] == S[1]:
        print(1)
    else:
        print(2)

def SSS():
    for i in range(0, len(S) - 1):
        if S[i] == S[i + 1]:
            del S[i]
            break
    iii.append(len(S))
    if iii[len(iii)-2] == iii[-1] or iii[-1] == 1:
        print(iii[-1])
    else:
        SSS()

SSS()

Submission status: Runtime Error

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

N = int(input())
N = N-1
S = input()
s = ' '
o = ' '
n = 0
for i in range(N):
  if S[n] == S[n+1]:
    if s[-1] != S[n]:
      s = s + S[n]
    n = n + 1
  else:
    if s == o:
      s = s + S[n]
      s = s.lstrip()
    s = s + S[n+1]
    n = n + 1
  print(s)
print(len(s.lstrip()))

Submission status: Runtime Error

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

iii = []
iii.append(len(S))

if N == 1:
    print(1)
    exit()

def SSS():
    for i in range(0, len(S) - 1): 
        if S[i] == S[i + 1]: 
            del S[i]
            break
    iii.append(len(S))
    if iii[len(iii)-2] == iii[-1] or iii[-1] == 1:
        print(iii[-1])
    else:
        SSS()

SSS()

Submission status: Runtime Error

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

for i in range(len(S)-2):
  while S[i]==S[i+1]:
    if S[i]==S[i+1]:
      S.remove(S[i])

print(len(S))

Submission status: Runtime Error

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

iii = []
iii.append(len(S))

if iii[0] == 1:
    print(1)
    exit()

def SSS():
    for i in range(0, len(S) - 1): 
        if S[i] == S[i + 1]: 
            del S[i]
            break
    iii.append(len(S))
    if iii[len(iii)-2] == iii[-1] or iii[-1] == 1:
        print(iii[-1])
    else:
        SSS()

SSS()

Submission status: Runtime Error

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

iii = []
iii.append(len(S))

def SSS():
    for i in range(0, len(S) - 1): 
        if S[i] == S[i + 1]: 
            del S[i]
            break
    iii.append(len(S))
    if iii[len(iii)-2] == iii[-1] or iii[-1] == 1:
        print(iii[-1])
    else:
        SSS()

SSS()

Submission status: Runtime Error

Solution code:
N = int(input())

S = list(map(str, input()))

iii = []
iii.append(len(S))

def SSS():
    for i in range(0, len(S) - 1): 
        if S[i] == S[i + 1]: 
            del S[i]
            break
    iii.append(len(S))
    if iii[len(iii)-2] == iii[-1] or iii[-1] == 1:
        print(iii[-1])
    else:
        SSS()

SSS()

Submission status: Runtime Error

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

mark = 0
dekiru_f = True

while dekiru_f:
	if len(S) == 1:
		break
	elif S[mark] == S[mark+1]:
		S = S.replace("{}{}".format(S[mark], S[mark+1]), "{}".format(S[mark]))
	elif S[mark] != S[mark+1]:
		mark += 1
		l = len(S)
		if mark == l-1:
			dekiru_f = False
		else:
			continue

print(len(S))

Submission status: Runtime Error

Solution code:

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, L, ABC, Q, ST):

    g = defaultdict(dict)
    for a, b, c in ABC:
        g[a][b] = c
        g[b][a] = c
    
    dd = defaultdict(lambda: -1)
    def f(s, t):
        if (s, t) in dd:
            return dd[(s, t)]
        q = [(0, s)]
        done = set([s])
        d = 0
        while q:
            d, u = heapq.heappop(q)
            if u in done:
                continue
            qq = [(-L, u)]
            cand = set()
            while qq:
                rem, uu = heapq.heappop(qq)
                rem = -rem
                for vv in g[uu]:
                    if rem-g[uu][vv] < 0:
                        continue
                    if vv in done:
                        continue
                    qq.append((-(rem-g[uu][vv]), vv))
                    cand.add(vv)
            
            done |= cand
            for v in cand:
                dd[(s, v)] = d
                heapq.heappush(q, (d+1, v))

        for i in range(1, N+1):
            if i not in done:
                dd[(s, i)] = -1

        return dd[(s, t)]

    for s, t in ST:
        print(f(s, t))



def main():
    N, M, L = read_int_n()
    ABC = [read_int_n() for _ in range(M)]
    Q = read_int()
    ST = [read_int_n() for _ in range(Q)]
    (slv(N, M, L, ABC, Q, ST))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
N = int(input())

S = list(map(str, input()))

iii = []
iii.append(len(S))

def SSS():
    for i in range(0, len(S) - 1): 
        if S[i] == S[i + 1]: 
            del S[i]
            break
    iii.append(len(S))
    if iii[len(iii)-2] == iii[-1] or iii[-1] == 1:
        print(len[-1])
    else:
        SSS()

SSS()

Submission status: Runtime Error

Solution code:
N = int(input())

S = list(map(str, input()))

iii = []
iii.append(len(S))

def SSS():
    for i in range(0, len(S) - 1): 
        if S[i] == S[i + 1]: 
            del S[i]
            break
    iii.append(len(S))
    if iii[len(iii)-2] == iii[-1] or iii[-1] == 1: 
        print("".join(S))
    else:
        SSS()

SSS()

Submission status: Runtime Error

Solution code:
N = int(input())

S = list(map(str, input()))

iii = []
iii.append(len(S))

def SSS():
    for i in range(0, len(S) - 1): 
        if S[i] == S[i + 1]: 
            del S[i]
            break
    iii.append(len(S))
    if iii[len(iii)-2] == iii[-1]:
        print("".join(S))
    else:
        SSS()

SSS()

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

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

D =[1]


def dfs(x):
    for dx in D:
        C =B[x]
        B[x] = "."
        nx = x + dx
        if nx >= 0 and nx <= a-1 and B[nx] == C:
            dfs(nx)

res = 0
for i in range(a):
        if B[i] != ".":
            dfs(i)
            res += 1
print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

total = []

def yugo(st,x):
	if len(st) <= x + 1:
		return st[x],-1
	if st[x] == st[x + 1]:
		return yugo(st,x+1)
	else:
		return st[x] , x+1

x= 0
Y = []
for i in range(10000):
	y,x = yugo(S,x)
	if x == -1 :
		Y = Y + [y]
		break
	Y = Y + [y]
	
print(len(Y))

Submission status: Runtime Error

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

Submission status: Runtime Error

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