peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
s = list(input())
n = len(s)

if n == 1:
    print("D")
elif n == 2:
    print("DP")
else:
    for i in range(1,n-1):
        if s[i] == '?' and s[i+1] == 'D':
            s[i] = 'P'
    for i in range(n):
        if s[i] == '?':
            s[i] = 'D'
    print(''.join(s))
# Judge status: Accepted
s = input()
if s == "Sunny": print("Cloudy")
elif s == "Cloudy": print("Rainy")
elif s == "Rainy": print("Sunny")
# Judge status: Accepted
n, k = map(int,input().split())
 
ans = 0
for select in range(k, n + 2):
    min_ = select * (select - 1) / 2
    max_ = select * (2 * n - select + 1) / 2
    ans += (max_ - min_ + 1)
print(int(ans % (10**9 + 7)))
# Judge status: Accepted
def resolve():
	r = int(input())
	print(2 * r * 3.14159265358)
resolve()
# Judge status: Accepted
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
n, d = M()
ans = 0
for _ in range(n):
    x, y = M()
    if x**2 + y**2 <= d**2:
        ans += 1
print(ans)
# Judge status: Wrong Answer
h1, m1, h2, m2, k = map(int, input().split())

time = (h2 - h1) * 60 + (m2 - m1) - 1

import math

print(math.floor(time // k) * k)
# Judge status: Wrong Answer
import numpy as np
N,M=map(int,input().split())
p=list(map(int,input().split()))
if np.sum(p)>M:
  print(-1)
else:
  print(N-np.sum(p))
# Judge status: Accepted
a, b, k = map(int, input().split())
if k - a <= 0:
  a -= k
elif b - (k-a) >= 0:
  b -= (k-a)
  a = 0
else:
  a = 0
  b = 0 

print(a,b)
# Judge status: Accepted
a,b,c,d = map(int,input().split())
all_val = b-a+1
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
if a%c == 0:
  c_val = b//c-a//c+1
else:
  c_val = b//c-a//c
if a%d == 0:
  d_val = b//d-a//d+1
else:
  d_val = b//d-a//d
if a%lcm(c,d) == 0:
  lcm_val = b//lcm(d,c)-a//lcm(d,c)+1
else:
  lcm_val = b//lcm(d,c)-a//lcm(d,c)
print(all_val-c_val-d_val+lcm_val)
# Judge status: Wrong Answer
s = list(map(int,input()))

n = int(len(s)/2)

a = [0]*len(s)
b = [0]*len(s)

for i in range(n):
  a[2*i] = 0
  a[2*i+1] = 1
  b[2*i] = 1
  b[2*i+1] = 0

if len(s)%2 ==1:
  a[len(s)-1] = 0
  b[len(s)-1] = 1 

print(a)
print(b)

an = 0
bn = 0

for j in range(len(s)):
  if a[j] != s[j]:
    an += 1
  if b[j] != s[j]:
    bn += 1

print(min(an, bn))
# Judge status: Accepted
MAX_N = 110
MAX_W = 10 ** 5 + 100
N, W = map(int, input().split())
w = [0] * MAX_N
v = [0] * MAX_N
for i in range(N):
    w[i], v[i] = map(int, input().split())
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(N):
    for sum_w in range(W + 1):
        if sum_w - w[i] >= 0:
            dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - w[i]] + v[i])
        dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w])
print(dp[N][W])
# Judge status: Accepted
import collections

s=input()

s=list(s)

c = collections.Counter(s)

score_sorted = sorted(c.items(), key=lambda x:-x[1])

val = []

for i, j in score_sorted:
    val.append(j)


if len(val) == 2:
    val.append(0)
elif len(val) == 1:
    val.append(0)
    val.append(0)
    
val.sort()

if 0<= val[2]-val[0] <=1:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n,*a=map(int,open(0).read().split())
a.sort()
b=[0]*(10**6+1)
for i in a:
    b[i]+=1
    if b[i]==1:
        for j in range(2*i,10**6+1,i):
            b[j]+=100
print(b.count(1))
# Judge status: Wrong Answer
def main():
  from itertools import groupby

  s = list(input())
  f = 0
  ans = 0

  for k,v in groupby(s):
    d = len(tuple(v))
    left = d if k==">" else 0
    right = d if k=="<" else 0
    ans += -1*f*(f<left) + d*(d+1)//2 -left*(f>left)  
    f = right 

  print(ans) 

if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b, c = map(int, input().split())
ans = "Yes" if a + b >= c else "No"
print(ans)
# Judge status: Accepted
MOD = 10**9 + 7
n, m = map(int, input().split())
if abs(n - m) > 1:
    ans = 0
else:
    ans = 1
    for i in range(1, n+1):
        ans *= i
        ans %= MOD
    for i in range(1, m+1):
        ans *= i
        ans %= MOD
    if n == m:
        ans *= 2
        ans %= MOD
print(ans)
# Judge status: Accepted
n = list(input())
if "7" in n:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
A,B = map(int,input().split())
print(A+B-24 if A+B>=24 else A+B)
# Judge status: Wrong Answer
n = int(input())

if n >= 15:
    print(800 * n - (200 * n // 15))
else:
    print(800 * n )
# Judge status: Wrong Answer
n = int(input())
s = sorted([int(input()) for _ in range(n)])

print(sum(s))
# Judge status: Wrong Answer
A = int(input()) 
ans = min([A//i for i in range(2,10) if A%i == 0], default = 0)

print("Yes") if 1<=ans<=9 else print("No")
# Judge status: Wrong Answer
S = input()
leng = len(S)
ans = ''

for n in range(leng):
    ans += '*'

print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())
n = 1
A = n//2 * (n+1)

def snow(x):
  n = 1
  while n / 2 * (n + 1) < x:
    n += 1
  return round(n / 2 * (n + 1)) - x

while snow(b+snow(a)) != 0:
  a += 1

print(snow(a))
# Judge status: Accepted
a=input();
if a[3]==a[2] and a[5]==a[4]:
	print("Yes");
else:
	print("No")
# Judge status: Wrong Answer
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code

def resolve():
    S=input()
    W=["Sunny","Cloudy","Rainy"]
    if S==S[0]:print(W[1])
    elif S==S[1]:print(W[2])
    else: print(W[-1])
    #%%submit!
resolve()
# Judge status: Wrong Answer
A, B, X = map(int, input().split())
if 0 < X - A <= B:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc132_c

n = int(input())
d = list(map(int, input().strip().split()))

d = sorted(d)
res = d[n//2] - d[n//2-1]
print(res)
# Judge status: Wrong Answer
S = input().strip()
C = {"a":0,"b":0,"c":0}
for i in range(len(S)):
    C[S[i]] += 1
x = min(C["a"],C["b"],C["c"])   
C["a"] -= x
C["b"] -= x
C["c"] -= x
if C["a"]+C["b"]+C["c"]==1 or C["a"]==C["b"]+C["c"] or C["b"]==C["a"]+C["c"] or C["c"]==C["a"]+C["b"]:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
#!/usr/bin/env python3


def solve(S: str):
    return sum([a != b for a, b in zip(S, reversed(S))]) // 2


def main():
    S = input().strip()
    answer = solve(S)
    print(answer)


if __name__ == "__main__":
    main()
# Judge status: Accepted
from fractions import gcd

a, b = [int(i) for i in input().split()]

print(int((a*b)/gcd(a,b)))
# Judge status: Accepted
S = list(input())
T = list(input())

ans = 0
for i in range(len(S)):
    if S[i] != T[i]:
        ans += 1
print(ans)
# Judge status: Wrong Answer
syu,n=map(int,input().split())
a=[int(i) for i in input().split()]
clock=a[n-1]-a[0]
han_clock=(a[n-2]-a[1])+(a[0]+syu-a[n-1])
print(min(clock,han_clock))
# Judge status: Wrong Answer
X,a,b=map(int,input().split())
if a+X>=b:
  print("delicious")
else:
  print("dangerous")
# Judge status: Accepted
s = input()
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in range(len(s)) :
    if s[i] in alpha :
        alpha.remove(s[i])
if alpha :
    print(alpha[0])
else :
    print("None")
# Judge status: Wrong Answer
n,k = map(int,input().split())
s = list(input())
for i in range(n):
    temp = str(s[i])
    print(type(temp))
    if i == k - 1:
        s[i] = temp.lower()  
S = ''.join(s)         
print(S)
# Judge status: Accepted
N = int(input())
if N % 2 == 1:
    print(0)
    exit()

ans = 0
N //= 2
i = 1
while N >= 5 ** i:
    ans += (N // 5 ** i)
    i += 1

print(ans)
# Judge status: Accepted
S = input()

S_ = (S
    .replace('eraser', '')
    .replace('erase', '')
    .replace('dreamer', '')
    .replace('dream', '')
)

if S_ == '':
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
N = int(input())
a=[0]*(N+1)
a[0]=[0,0,0]
for i in range(1,N+1):
    a[i]=[int(j) for j in input().split()]

flag = True
for i in range(N):
    distance = abs(a[i][1]-a[i+1][1]) + abs(a[i][2]-a[i+1][2])
    del_t = a[i+1][0]-a[i][0]

    if del_t - distance < 0 or (del_t - distance)%2 != 0:
        flag = False
        
if flag:
    print("Yes")
else:
    print("NO")
# Judge status: Accepted
S = list(input())
N = len(S)
num = 0
cnt = [0]*2019
cnt[0] = 1
d = 1
#T[i]: i+1文字目以降を数とみなしたときの数
for i in range(N-1, -1, -1):
    num += int(S[i]) * d
    num %= 2019
    # num = (num + int(S[i]) * 10 ** (N- i -1)) % 2019
    cnt[num] += 1
    d *= 10
    d %= 2019

ans = 0
for c in cnt:
    ans += c * (c-1) // 2
print(ans)
# Judge status: Wrong Answer
n=int(input())
a=[0]+sorted(list(map(int,input().split())))
x=a[-1]
m=a[-1]
for i in a:
  if m>abs(i-x/2):y=i
print(x,y)
# Judge status: Accepted
from collections import defaultdict

S = tuple(input())
T = tuple(input())

# S->T と T->S の変換表
s_to_t = defaultdict(set)
t_to_s = defaultdict(set)
for s,t in zip(S,T):
    s_to_t[s].add(t)
    t_to_s[t].add(s)


# 1対1対応しているか
flag = True
for v in s_to_t.values():
    if len(v) > 1:
        flag = False
for v in t_to_s.values():
    if len(v) > 1:
        flag = False

# print
if flag:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
a,b,k = map(int,input().split())

tmp=0
ind=1
while True:
    if a%ind==0 and b%ind==0:
        tmp+=1
        if tmp==k:
            print(ind)
            sys.exit()
    ind+=1
# Judge status: Accepted
from itertools import product
a,b,c,d=map(int,input())
for op1,op2,op3 in product((1,-1),repeat=3):
    if a+op1*b+op2*c+op3*d==7:
        x='+'if op1==1else'-'
        y='+'if op2==1else'-'
        z='+'if op3==1else'-'
        print('{}{}{}{}{}{}{}=7'.format(a,x,b,y,c,z,d))
        exit()
# Judge status: Accepted
a,b = map(int,input().split())
c = min(a,b)
d = max(a,b)
print(str(c)*d)
# Judge status: Wrong Answer
a,b = map(int,input().split())

cnt = 0
for i in range(a,b):
  if str(i) == str(i)[::-1]:
    cnt+=1
print(cnt)
# Judge status: Accepted
import math

N, L = map(int, input().split())

sum = 0
minimum = 99999
for i in range(1,N+1):
    aji = L + i - 1
    sum += aji
    if (math.fabs(minimum) > math.fabs(aji)):
        minimum = aji

print(sum - minimum)
# Judge status: Accepted
n,k=map(int,input().split())
n=[i+1 for i in range(n)]

for i in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for j in a:
        if j in n:
            n.remove(j)
    
print(len(n))
# Judge status: Wrong Answer
def solve(XL, N):
    XL.sort(key=lambda x:x[0])
    count = N
    for i in range(1, N):
        if XL[i][0] < XL[i-1][1]:
            XL[i][1] = XL[i-1][1]
            count -= 1
    return count
N = int(input())
XL = []
for i in range(N):
    x, l = map(int, input().split(' '))
    XL.append([x-l, x+l])
print(solve(XL, N))
# Judge status: Accepted
N,R=map(int,input().split())
if N < 10:
    print(R+(100*(10-N)))
else:
    print(R)
# Judge status: Accepted
A=input()
B=input()
X="NO"
if A[0]==B[2] and A[1]==B[1] and A[2]==B[0]:
  X="YES"
print(X)
# Judge status: Wrong Answer
x=int(input())

if x>=400 and x<=599:
    print(8)
elif x>=600 and x<=799:
    print(7)
elif x>=800 and x<=999:
    print(6)
elif x>=1000 and x<=1199:
    print(5)
elif x>=1200 and x<=1399:
    print(4)
elif x>=1300 and x<=1499:
    print(3)
elif x>=1500 and x<=1699:
    print(2)
elif x>=1600 and x<=1799:
    print(1)
# Judge status: Wrong Answer
N, M = map(int, input().split())
X = sorted(list(map(int, input().split())))

Y = []
for i in range(M-1):
  Y.append(X[i+1] - X[i])

Y.sort()
print(sum(Y[:-N+1]))
# Judge status: Wrong Answer
N = int(input())
lst = list(map(int, input().split()))
avg = round(sum(lst), N)

result = 0
for i in lst:
    result += (i - avg)**2

print(result)
# Judge status: Wrong Answer
S = input()
n = len(S) + 1
num = [0] * n
for i in range(n-1):
    if S[i] == '<':
        num[i + 1] = max(num[i] + 1, num[i + 1])
for i in range(n-2, 0, -1):
    if S[i] == '>':
        num[i] = max(num[i + 1] + 1, num[i])
print(sum(num))
# Judge status: Accepted
N, A, B = map(int, input().split())
S = input()
passed = 0
foreigner = 0
for s in S:
  if s == "c":
    print("No")
  elif s == "a":
    if passed < A + B:
      print("Yes")
      passed += 1
    else:
      print("No")
  elif s == "b":
    if passed < A + B and foreigner < B:
      print("Yes")
      passed += 1
      foreigner += 1
    else:
      print("No")
# Judge status: Wrong Answer
n,k=map(int,input().split())
h=sorted([int(input()) for _ in range(n)])
ans=10**9
for i in range(n-k):
    ans=min(h[k+i]-h[i],ans)
print(ans)
# Judge status: Accepted

x,y,z = map(int, raw_input().split())
cumul = x / (y + z)
x %= y + z
if x < z:
	cumul -=1
print max(cumul,0)
# Judge status: Wrong Answer
N,M= list(map(int , input().split()))
for i in range (M):
    n = i+1
    print (n,N-n)
# Judge status: Accepted
#abc125 c
n=int(input())
a=list(map(int,input().split()))

def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

fl_gcd=[0]*(n+1)
fr_gcd=[0]*(n+1)

for i in range(n):
    fl_gcd[i+1]=gcd(fl_gcd[i],a[i])
    fr_gcd[n-i-1]=gcd(fr_gcd[n-i],a[n-1-i])
#print(fr_gcd)
#print(fl_gcd)

ans=0
for i in range(n):
    lr_gcd=gcd(fl_gcd[i],fr_gcd[i+1])
    ans=max(ans,lr_gcd)
print(ans)
# Judge status: Accepted
W = input()

if 'RRR' in W:
    print(3)
elif 'RR' in W:
    print(2)
elif 'R' in W:
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
a, b = map(int, input().split())
s = input()

flag = 0

if s[a] == "-":
    if s[a:].isdecimal() and s[a+1:].isdecimal():
        flag = 1
    else:
        flag = 0


if flag:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a=input()
b=0
count=0
for i in range(0,len(a)-1):
    if a[i]=='R' and a[i+1]=='R':
        count+=1
    if a[i]=='R' and a[i+1]!='R':
        count+=1
        b=max(b,count)
        count=0
print(b)
# Judge status: Wrong Answer
N = int(input())
pre = 0
ans = 0
for a in input().split():
    a = int(a)
    ans += max(a-pre, 0)
    pre = max(pre, a)
print(ans)
# Judge status: Wrong Answer
N = list(input())

if len(N) < 2:
    if int(N[0]) == 9:
        print('Yes')
    else:
        print('No')
elif len(N) >= 2:
    l = [int(n) for n in N]
    a = sum(l)
    if a % 9 == 0:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
S = input()

N = len(S)
# [0:N//2] == [(N+1)//2:N]
A = int(N//2)
B = int((N+1)//2)
flag = True
if S[0:A] == S[B:N][::-1]:
    N = A
    A = int(N // 2)
    B = int((N + 1) // 2)
    if S[0:A] == S[B:N][::-1]:
        print("Yes")
        flag = False

if flag:
    print("No")
# Judge status: Accepted
a,b=map(int,input().split())
if a%3 == 0:
    print("Possible")
elif b%3 == 0:
    print("Possible")
elif (a+b)%3 == 0:
    print("Possible")
else:
    print("Impossible")
# Judge status: Accepted
x = int(input())
for i in range(1,10**5):
  a = int(i*(i+1)/2)
  if x<=a:
    print(i)
    exit()
# Judge status: Accepted
L=list(map(int,input().split()))
L.sort()
if L[0]+L[1]==L[2]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N, K = map(int, input().split())
print(min(N % K, K - N % K))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
k = 1-a[0]
s -= a[0]
ans = 1

for i in range(1,n+1):
  if k*2 <= s:
    k *= 2
  else:
    k = s
  ans += k
  k -= a[i]
  s -= a[i]

if k == 0 and s == 0:
  print(ans)
else:
  print(-1)
# Judge status: Accepted
# coding: utf-8
# Your code here!
a, b = map(int,input().split())

s = int(str(a)+str(b))

if s ** 0.5 == int(s ** 0.5):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import sys

n,k = map(int,input().split())
if n == 1:
	print(1)
	sys.exit()
i = 0
num = 1
while True:
	if n < num:
		break
	num *= k
	i += 1

print(i)
# Judge status: Wrong Answer
n = int(input())
counter = 0
s = "TEMP"
list = []

while n > 0:
  s = input()
  list.append(s)
  counter = 0
  for item in list:
    if item == s:
      counter = counter - 1
    counter = counter + 1
  n = n - 1

print(counter)
# Judge status: Accepted
S = int(input())
#	X1 = X1 = 0
#	S = X2 * Y3 - X3 * Y2
#	X2 = 10^9, X3 = 1
#	S = 10^9 * Y3 - Y2
Y3 = (S + 10**9 - 1) // 10**9
Y2 = 10**9 * Y3 - S
print(0, 0, 10**9, Y2, 1, Y3)
# Judge status: Accepted
import math

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

a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
m = max(a)
b.sort(reverse=True)

ans = 0
for i in range(n):
    if m <= b[i]:
        h -= b[i]
        ans += 1
        if h <= 0:
            print(ans)
            exit()

ans += math.ceil(h / m)
print(ans)
# Judge status: Wrong Answer
n=int(input())
num=[i*(i+1)//2 for i in range(4500)]
ans=""
while n>0:
    for i in range(4500):
        if num[i]==n:
            ans+=str(i)
            n-=i
            break
        elif i>1 and num[i]>n and num[i-1]:
            ans+=str(i)
            n-=i
            break
for i in range(len(ans)):
    print(ans[len(ans)-1-i])
# Judge status: Accepted
N=int(input())
List=list(map(int, input().split()))
List=sorted(List)
print(List[int(N/2)]-List[int((N/2)-1)])
# Judge status: Accepted
a,b,c=map(int,input().split())

if a>c>b or a<c<b:
    print('Yes')

else:
    print('No')
# Judge status: Wrong Answer
l = list(map(int,input().split()))
l.sort(reverse = 1)
print(l)
print(l[0]*10 +l[1] + l[2])
# Judge status: Accepted
n = int(input())

A = list(map(int, input().split()))

num_4 = 0
num_2 = 0
num_odd = 0

for i in A:
    if i % 4 == 0:
        num_4 += 1
    elif i % 2 == 0:
        num_2 += 1

num_odd = n - num_2 - num_4

if n - num_4*2 == num_2 or n - num_4 * 2 == 1 or num_2 > n//2 or num_4 + 1 > n//2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from collections import defaultdict
n, m = map(int, input().split())
r = set()
r.add(1)
d = defaultdict(int)
for i in range(m):
  x, y = map(int, input().split())
  d[x] -= 1
  d[y] += 1
  if x in r:
    r.add(y)
ans = len(list(r))
for e in d:
  if d[e] == -1 and e in r:
    ans -= 1
print(ans)
# Judge status: Accepted
A, B, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = min(A) + min(B)

for _ in range(M):
    x, y, c = map(int, input().split())
    x -= 1
    y -= 1
    ans = min(ans, A[x]+B[y]-c)

print(ans)
# Judge status: Accepted
def main():
    n = int(input())
    cnt = [1] * (n + 1)

    for i in range(2, n + 1):
        cnt[i] += 1
        for j in range(i * 2, n + 1, i):
            cnt[j] += 1
    #print(cnt)

    res = 0
    for i in range(1, n + 1):
        res += i * cnt[i]
    print(res)
if __name__ == '__main__':
    main()
# Judge status: Accepted
n, k = map(int, input().split())

nums = []
for _ in range(n):
  ab = list(map(int, input().split()))
  nums.append(ab)
sn = sorted(nums)

i = 0
while k > 0:
  if sn[i][1] < k:
    k -= sn[i][1]
  else:
    print(sn[i][0])
    break
  i += 1
# Judge status: Accepted
from bisect import bisect_right

N, *A = map(int, open(0).read().split())

x = [1] * (N + 1)
for i in range(N):
    j = bisect_right(x, -A[i])
    x[j] = -A[i]
print(sum(v != 1 for v in x))
# Judge status: Accepted
n = int(input())
l = []
ans = 0
for i in range(n):
  s = "".join(sorted(list(input())))
  l.append(s)
l.sort()
cnt = 1
for i in range(1, n):
  if l[i] != l[i-1]:
    ans += cnt*(cnt-1)//2
    cnt = 1
  else:
    cnt += 1
ans += cnt*(cnt-1)//2
print(ans)
# Judge status: Accepted
Q, H, S, D = map(int, input().split())
N = int(input())
kouho = []
mv = int(1e9)

if N % 2 == 0:
    for i, j in zip([Q, H, S, D], [0.25, 0.5, 1, 2]):
        kouho.append(int((N // j)*i))
else:
    for i, j in zip([Q, H, S, D], [0.25, 0.5, 1, 2]):
        kouho.append(int((N // j)*i))

    for i, j in zip([Q, H, S], [0.25, 0.5, 1]):
        mv = int(min(i // j, mv))
    kouho[-1] += mv
print(min(kouho))
# Judge status: Accepted
def oddmoji(x):
  lx=int(len(x)/2)
  if x[:lx]==x[lx:]:
    return True
  else:
    return False

s=input()
ls=len(s)
for i in range(ls-2, 0, -2):
  if oddmoji(s[:i]):
    print(i)
    break
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500 + j*100 + k*50 == x:
        count+=1

print(count)
# Judge status: Accepted
K, N = map(int, input().split())
house = list(map(int,input().split()))
min = house[N - 1] - house[0]
 
for i in range(N - 1):
  if K - (house[i + 1] - house[i]) < min:
    min = K - (house[i + 1] - house[i])
 
print(min)
# Judge status: Accepted
N= int(input())

S=N%1000

if S !=0:
    print(abs(S-1000))
else:
    print(0)
# Judge status: Accepted
# -*- coding: utf-8 -*-

# スペース区切りの文字列の入力
st = input().split()
#商
div = int(st[0]) // (int(st[1]) + int(st[2]))
#余り
rem = int(st[0]) % (int(st[1]) + int(st[2]))

if(rem < int(st[1])):
  print(div * int(st[1]) + rem)
else:
  print(div * int(st[1]) + int(st[1]))
# Judge status: Wrong Answer
import sys

readline = sys.stdin.readline
N = int(readline())
A = list(map(int, readline().split()))

x = [0] * (10**5+5)
for a in A:
    x[a] += 1
s = sum(A)
Q = int(readline())
for _ in range(Q):
    b, c = map(int, readline().split())
    s += (c - b) * x[b]
    print(s)
    x[c] += x[b]
# Judge status: Accepted
s = input()
t = input()
if len(t) == len(s) + 1:
  if s == t[:len(t) - 1]:
    print("Yes")
  else:
    print("No")
else:
  print("No")
# Judge status: Wrong Answer
n = int(input())
l = list(map(int,input().split()))
from itertools import accumulate
cum = list(accumulate(l))

if cum[-1]%2==0 and cum[-1]//2 in cum:
    print(0)
    exit()

mid = -(-cum[-1]//2)

i=0
while True:
    if cum[i] >= mid:
        x = i
        break
    else: i+=1

j=0
while True:
    if (cum[x]-j)*2 == cum[-1]-j:
        print(j)
        break
    else: j+=1
# Judge status: Accepted
#cotest_temp
#n = int(input())
a,b,c = map(int,input().split())
#lst1 = list(map(int,input().split()))

if a + b >= c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
# 連続するK本のろうそくに火をつけるので、最小となる組を全探索する
N, K = map(int, input().split())
X = list(map(int, input().split()))

ans = float("INF")
for i in range(N - K + 1):
    lr = abs(X[i]) + abs(X[i] - X[i + K - 1])
    rl = abs(X[i + K - 1]) + abs(X[i + K - 1] - X[i])
    ans = min(ans, min([lr, rl]))

print(ans)
# Judge status: Accepted
N,M = map(int,input().split())
if N%2:
    for i in range(M):
        print(i+1, M*2-i)
else:
    b = M//2
    a = M - b
    for i in range(a):
        print(i+1, a*2-i)
    for i in range(b):
        print(a*2+1+i, M*2+1-i)
# Judge status: Accepted
x=int(input())
count=0
t=x//11
k=x-(t*11)
if k==0:
    count+=2*t
elif 1<=k<=6:
    count+=2*t+1
else:
    count+=2*t+2
print(count)
# Judge status: Accepted
N, K = map(int, input().split())
A=list(map(int,input().split()))
A.sort()
right = A[-1]+1
left = 0
flag = True
mid = (left+right)//2
minN = right
result = mid
while right-left>1 and flag:
    mid = (left+right)//2
    count = 0
    for i in A:
        count += (i-1)//mid
    if count <= K:
        right = mid
        if minN>mid:
            minN = mid
            result = mid
    elif count > K:
        left = mid
print(result)
# Judge status: Accepted
import bisect
from collections import deque
N=int(input())

que=deque([-1])
for i in range(N):
    a=int(input())
    
    if que[0]<a:
        i=bisect.bisect_left(que, a)
        que[i-1]=a
    else:
        que.appendleft(a)

print(len(que))
#print(que)
# Judge status: Accepted
def main():
    S = input()
    cnt = 0
    before, current = '', ''
    for i, c in enumerate(S):
        current += c
        if current != before:
            before = current
            current = ''
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()