Harryxun/stf_run huggingface dataset:
s=input()
t=input()
c=0
for i in (2):
  if s[i]==t[i]:
    c+=1
print(c)

### FIXED CODE ###

s=input()
t=input()
c=0
for i in range(3):
  if s[i]==t[i]:
    c+=1
print(c)
A, B = [int(n) for n in input().split()]
    if A+B < 10:
      print(A+B)
    else:
      print("error")

### FIXED CODE ###

A, B = [int(n) for n in input().split()]
if A+B < 10:
  print(A+B)
else:
  print("error")
A = int(input())
B = int(input())
print(A*B)

### FIXED CODE ###

A, B = map(int,input().split())
print(A*B)
# coding: utf-8
# Your code here!
r , g , b , n = map(int,input().split())
ans = 0
R = -(-n//r)
G = -(-n//g)
for i in range(R+1):
    for j in range(G+1):
        su = n-r*i-g*j
        if n-r*i-g*j < 0:
            break
        else:
            if (su/b).is_integer():
                ans += 1
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
print(n-k+1)
a = [int(i) for i in input().split()]
if a == b == c :
    print (1)
elif a == b or b == c :
    print (2)
else :
    print (3)

### FIXED CODE ###

a, b, c = map(int, input().split())
if a == b == c :
    print (1)
elif a == b or b == c or c == a:
    print (2)
else :
    print (3)
class RollingHash:
    def __init__(self, s):
        b1, b2 = 1007, 2009
        self.mod1, self.mod2 = 10**9+7, 10**9+9
        self.size = len(s)
        self.string = s

        self.hash1 = self.make_hashtable(b1, mod1)
        self.hash2 = self.make_hashtable(b2, mod2)
        self.pow1 = self.make_powtable(b1, mod1)
        self.pow2 = self.make_powtable(b2, mod2)

    def make_hashtable(self, B, MOD):
        hashtable = [0] * (self.size+1)
        for i in range(1, self.size+1):
            hashtable[i] = (hashtable[i-1] * B + ord(self.string[i-1]))%MOD
        return hashtable
    
    def make_powtable(self, B, MOD):
        power = [0] * (self.size+1)
        power[0] = 1
        for i in range(1, self.size+1):
            power[i] = (B * power[i-1])%MOD
        return power

    def get_hash(self, l, length):
        r = length+l-1
        l -= 1
        h1 = (self.hash1[r]-self.hash1[l]*self.pow1[r-l])%self.mod1
        h2 = (self.hash2[r]-self.hash2[l]*self.pow2[r-l])%self.mod2
        return (h1, h2)

from collections import defaultdict

def solve1():
    N = int(input())
    S = input()
    size = len(S)
    hash_table = RollingHash(S)

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

            left = 1
            right = min(j-i, size-j+1)+1

            while right-left>1:
                m = (left+right)//2
                if hash_table.get_hash(i, m)==hash_table.get_hash(j, m):
                    left = m
                else:
                    right = m
            ans = max(ans, left)

    print(ans)


def solve2():
    N = int(input())
    S = input()
    size = len(S)
    hash_table = RollingHash(S)

    def check(m):
        d = defaultdict(lambda :10**20)
        for i in range(1, size-m+2):
            h = hash_table.get_hash(i, m)
            d[h] = min(d[h], i)
            if (i-d[h])>=m:
                return True
        return False

    left, right = 0, size//2 + 1
    while right-left>1:
        m = (right+left)//2
        if check(m):
            left = m
        else:
            right = m

    print(left)

if __name__ == "__main__":
    # solve1()
    solve2()



### FIXED CODE ###

N = int(input())
S = input()
dp = [[0]*(N+1) for _ in range(N+1)]

for l in range(N)[::-1]:
    for r in range(l+1, N)[::-1]:
        dp[l][r] = dp[l+1][r+1]+1 if S[l]==S[r] else 0

ans = 0 
for l in range(N)[::-1]:
    for r in range(l+1, N)[::-1]:
        ans = max(ans, min(r-l, dp[l][r]))
print(ans)
#c
N,Q = list(map(int,input().split()))
S = input()
L = []
R = []
for i in range(Q):
    a = list(map(int,input().split()))
    L.append(a[0])
    R.append(a[1])

S_count = []
count = 0
A_flag = False

for i in range(len(S)):
    if A_flag == True:
        if S[i] == "C" :
            count += 1
    else:
        if S[i] == "A" :
            A_flag = True
        else:
            A_flag = False
    S_count = count

for i in range(Q):
    print(S_count[R[i]] - S_count[L[i]])

### FIXED CODE ###

#c
N,Q = list(map(int,input().split()))
S = input()
L = []
R = []
for i in range(Q):
    a = list(map(int,input().split()))
    L.append(a[0])
    R.append(a[1])

S_count = []
count = 0
A_flag = False

for i in range(len(S)):
    if A_flag == True:
        if S[i] == "C" :
            count += 1
   
    if S[i] == "A" :
        A_flag = True
    else:
        A_flag = False
    S_count.append(count)

for i in range(Q):
    print(S_count[R[i] - 1] - S_count[L[i] - 1])
s = str(input())

if len(s) == 2:
    if s[0] ==s[1]:
        start_ind =1
        end_ind = 2
    else:
        start_ind = -1
        end_ind = -1
        
elif len(s)>2:
    for i in range(len(s)-2):
        par_str = s[i:i+3]
        if (par_str.count(par_str[0])>=2) | (par_str.count(par_str[1])>=2):
            start_ind = i + 1
            end_ind = i + 3
            break

ans = str(start_ind) + ' ' + str(end_ind)

print(ans)

### FIXED CODE ###

s = str(input())

if len(s) == 2:
    if s[0] ==s[1]:
        start_ind =1
        end_ind = 2
    else:
        start_ind = -1
        end_ind = -1
        
elif len(s)>2:
    start_ind = -1
    end_ind = -1
    for i in range(len(s)-2):
        par_str = s[i:i+3]
        if (par_str.count(par_str[0])>=2) | (par_str.count(par_str[1])>=2):
            start_ind = i + 1
            end_ind = i + 3
            break
        
        

ans = str(start_ind) + ' ' + str(end_ind)

print(ans)
while True:
    m, f, r = map(int, input().split())
    if m == f == r== -1:
        break
    
    if s >= 80:
        print("A")
    elif s >= 65 and s < 80:
        print("B")
    elif (s >= 50 and s < 65) or f >= 50:
        print("C")
    elif s >= 30 and s < 50:
        print("D")
    else:
        print("F")
    




### FIXED CODE ###

while True:
    m, f, r = map(int, input().split())
    if m == f == r== -1:
        break
    s = m + f
    if m == -1 or f == -1:
        print("F")
    elif s >= 80:
        print("A")
    elif s >= 65:
        print("B")
    elif s >= 50:
        print("C")
    elif s >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")
from decimal import *

a, b = map(int, input().split())
ans = Decimal(a) * Decimal(b)
print(int(ans))


### FIXED CODE ###

from decimal import *

a, b = input().split()
ans = Decimal(a) * Decimal(b)
print(int(ans))
import numpy as np

N = input()
# N = int(input())
# t = np.array(list(map(int, input().split())))
t = map(int, raw_input().split())

odd = t[0::2]
even = t[1::2]

rest = 0

for _k in [odd, even]:
    uni = list(set(_k))
    cnt = np.zeros((len(uni), ))
    for _i in _k:
        cnt[uni.index(_i_)] += 1


### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
from collections import Counter
N = input()
t = np.array(map(int, raw_input().split()))

odd = t[0::2]
even = t[1::2]
rest = 0

co = Counter(odd)
ce = Counter(even)

omc = co.most_common()
emc = ce.most_common()

if omc[0][0] == emc[0][0]:
    if len(omc) < 2 and len(emc) < 2:       # same
        rest = len(even)
    elif len(omc) < 2:
        rest = len(even)
    elif len(emc) < 2:
        rest = len(odd)
    else:
        or1 = len(odd) - co.most_common()[0][1]
        or2 = len(odd) - co.most_common()[1][1]
        er1 = len(even) - ce.most_common()[0][1]
        er2 = len(even) - ce.most_common()[1][1]

        if or1 + er2 > or2 + er1:
            rest = or2 + er1
        else:
            rest = or1 + er2
else:
    rest = len(odd) - co.most_common()[0][1] + len(even) - ce.most_common()[0][1]


print rest
# トポロジカルソート->簡単なDP
N,M = map(int, input().split())
adj = [[] for _ in range(N)]
for _ in range(M):
    x,y = map(int, input().split())
    adj[x-1].append(y-1) 

visited = [False] * N
topo_order = [] # sort後を格納

# topological sort by DFS
def dfs_visit(node):
    global visited, topo_order
    if visited[node]: return
    visited[node] = True
    for neighbor in adj[node]:
        if not visited[neighbor]:
            dfs_visit(neighbor)
    # 帰りがけに追加
    topo_order.append(node)
    # print(topo_order)

# topological sort main
for node in range(N):
    dfs_visit(node)
topo_order = topo_order[::-1]
# print("topo_order: ", topo_order)

dp = [0]*N

for node in topo_order:
    for neighbor in adj[node]:
        dp[neighbor] = max(dp[neighbor], dp[node]+1)
print(max(dp))
# print(dp)

### FIXED CODE ###

# トポロジカルソート->簡単なDP
import sys
sys.setrecursionlimit(300000) # ないとerr

N,M = map(int, input().split())
adj = [[] for _ in range(N)]
for _ in range(M):
    x,y = map(int, input().split())
    adj[x-1].append(y-1) 
# print("adj list: ", adj)

visited = [False] * N
topo_order = [] # sort後を格納

# topological sort by DFS
def dfs_visit(node):
    global visited, topo_order
    if visited[node]: return
    visited[node] = True
    for neighbor in adj[node]:
        if not visited[neighbor]:
            dfs_visit(neighbor)
    # 帰りがけに追加
    topo_order.append(node)
    # print(topo_order)

# topological sort main
for node in range(N):
    dfs_visit(node)
topo_order = topo_order[::-1]
# print("topo_order: ", topo_order)

dp = [0]*N

for node in topo_order:
    for neighbor in adj[node]:
        dp[neighbor] = max(dp[neighbor], dp[node]+1)
print(max(dp))
# print(dp)
import collections
import sys

def primes(n):
  is_prime=[True]*(n+1)
  is_prime[0]=False
  is_prime[1]=False
  for i in range(2,int(n**0.5)+1):
    if not is_prime[i]:
      continue
    for j in range(i*2,n+1,i):
      is_prime[j]=False
  return [i for i in range(n+1) if is_prime[i]]

def fact(n):
  l=primes(int(n**0.5)+1)
  L=[]
  for i in range(len(l)):
    while n%l[i]==0:
      n=n//l[i]
      L.append(l[i])
    if n==1:
      break
  if n!=1:
    L.append(n)
  return L

def cmb(n,r,mod):
  if r<0 or r>n:
    return 0
  r=min(r,n-r)
  return g1[n]*g2[r]*g2[n-r]%mod

n,M=map(int,input().split())
if n==1 and M==1:
  print(1)
  sys.exit()
m=10**9+7
x=list(collections.Counter(fact(M)).values())

g1=[1,1]
g2=[1,1]
inverse=[0,1]

for i in range(2,max(x)+n):
  g1.append((g1[-1]*i)%m)
  inverse.append((-inverse[m%i]*(m//i))%m)
  g2.append((g2[-1]*inverse[-1])%m)

ans=1

for i in range(len(x)):
  ans*=cmb(x[i]+n-1,x[i],m)
  ans%=m
print(ans)

### FIXED CODE ###

import collections
import sys

def primes(n):
  is_prime=[True]*(n+1)
  is_prime[0]=False
  is_prime[1]=False
  for i in range(2,int(n**0.5)+1):
    if not is_prime[i]:
      continue
    for j in range(i*2,n+1,i):
      is_prime[j]=False
  return [i for i in range(n+1) if is_prime[i]]

def fact(n):
  l=primes(int(n**0.5)+1)
  L=[]
  for i in range(len(l)):
    while n%l[i]==0:
      n=n//l[i]
      L.append(l[i])
    if n==1:
      break
  if n!=1:
    L.append(n)
  return L

def cmb(n,r,mod):
  if r<0 or r>n:
    return 0
  r=min(r,n-r)
  return g1[n]*g2[r]*g2[n-r]%mod

n,M=map(int,input().split())
if M==1:
  print(1)
  sys.exit()
m=10**9+7
x=list(collections.Counter(fact(M)).values())

g1=[1,1]
g2=[1,1]
inverse=[0,1]

for i in range(2,max(x)+n):
  g1.append((g1[-1]*i)%m)
  inverse.append((-inverse[m%i]*(m//i))%m)
  g2.append((g2[-1]*inverse[-1])%m)

ans=1

for i in range(len(x)):
  ans*=cmb(x[i]+n-1,x[i],m)
  ans%=m
print(ans)
string = input()

moji_list = []
for i in range(4):
    moji_list[i] = string[i]

ue = ''
sita = ''
for j in range(2):
    ue += moji_list[i]
    sita += moji_list[i+2]

int_ue = int(ue)
int_sita = int(sita)

sw_ue = 0
sw_sita = 0
if 1<=int_ue and int_ue<=12:
    sw_ue += 1

if 1<=int_sita and int_sita<=12:
    sw_sita += 1

if sw_ue == 1 and sw_sita == 1:
    print('AMBIGUOUS')
elif sw_ue == 1 and sw_sita == 0:
    print('MMYY')
elif sw_ue == 0 and sw_sita == 1:
    print('YYMM')
elif sw_ue == 0 and sw_sita == 0:
    print('NA')

### FIXED CODE ###

string = input()

moji_list = [0 for _ in range(4)]
for i in range(4):
    moji_list[i] = string[i]

ue = ''
sita = ''
for j in range(2):
    ue += moji_list[j]
    sita += moji_list[j+2]

int_ue = int(ue)
int_sita = int(sita)

sw_ue = 0
sw_sita = 0
if 1<=int_ue and int_ue<=12:
    sw_ue += 1

if 1<=int_sita and int_sita<=12:
    sw_sita += 1

if sw_ue == 1 and sw_sita == 1:
    print('AMBIGUOUS')
elif sw_ue == 1 and sw_sita == 0:
    print('MMYY')
elif sw_ue == 0 and sw_sita == 1:
    print('YYMM')
elif sw_ue == 0 and sw_sita == 0:
    print('NA')
import numpy as np
N = int(input())
A = list(map(int, input().split()))

a_ = A[1]
d_ = np.sign(A[1] - A[0])
turn_p = 0
for a in A[2:]:
    d = np.sign(a - a_)
    #print(a, d, d_, turn_p)
    if d != 0:
        if d_ == 0:
            d_ = d
        elif d_ != d:
            turn_p += 1
            d_ = 0
    a_ = a 

print(turn_p+1)
    



### FIXED CODE ###

import numpy as np
N = int(input())
A = list(map(int, input().split()))

turn_p = 0
if N > 2:
    a_ = A[1]
    d_ = np.sign(A[1] - A[0])
    for a in A[2:]:
        d = np.sign(a - a_)
        #print(a, d, d_, turn_p)
        if d != 0:
            if d_ == 0:
                d_ = d
            elif d_ != d:
                turn_p += 1
                d_ = 0
        a_ = a 

print(turn_p+1)
a=input()
if a=='1':
  print('0')
 else:
  print('1')

### FIXED CODE ###

a=input()
if a=='1':
  print('0')
if a=='0':
  print('1')
def f(n):
  cnt = 0
  while n:
      cnt += 1
      n = n % bin(n).count('1')

  return cnt

def main():
  n = int(input())
  src = input()
  base = int(src, 2)
  base_cnt = src.count('1')

  basep = base % (base_cnt + 1)
  basem = base % (base_cnt - 1)

  for i in range(n - 1, -1, -1):
    num = None

    if src[n - i - 1] == '0':
      mod = base_cnt + 1
      num = (basep + pow(2, i, mod)) % mod
    else:
      mod = base_cnt - 1
      num = (basem - pow(2, i, mod)) % mod

    print(1 + f(num))


main()


### FIXED CODE ###


def f(n):
  cnt = 0
  while n:
      cnt += 1
      n = n % bin(n).count('1')

  return cnt

def main():
  n = int(input())
  src = input()
  base = int(src, 2)
  base_cnt = src.count('1')

  basep = base % (base_cnt + 1)
  basem = base % (base_cnt - 1) if base_cnt > 1 else 0

  for i, s in enumerate(src):
    i = n - 1 - i
    num = None

    if s == '0':
      mod = base_cnt + 1
      num = (basep + pow(2, i, mod)) % mod
    elif base_cnt > 1:
      mod = base_cnt - 1
      num = (basem - pow(2, i, mod)) % mod
    else:
      print(0)
      continue

    print(1 + f(num))


main()
N, K = map( int, input().split() )
 
now_N = 10 ** 19
while True:
  N = min( abs( N % K ),abs( K - N ),, now_N )
  if now_N == N:
    break
  now_N = N
print( now_N )

### FIXED CODE ###

N, K = map( int, input().split() )
 
now_N = 10 ** 19
while True:
  N = min( abs( N % K ),abs( K - N ), now_N )
  if now_N == N:
    break
  now_N = N
print( now_N )
#複数の入力
input_list = input().split( )
input_list = input_list.sort
print(input_list[0],input_list[1],input_list[2])

### FIXED CODE ###

#複数の入力
input_list = input().split( )
print(input_list[2],input_list[0],input_list[1])
import sys
for line in sys.stdin:
	a = input()
	b = input()
	c = int(a)+int(b)
	d = 1
	while(int(c/10) != 0):
		d += 1
		c = int(c/10)
	print(d)


### FIXED CODE ###

import sys
for line in sys.stdin:
	l=0
	for l in range(len(line)):
		if(line[l] == ' '):
			p = l
			break
	a = line[0:p]
	b = line[p+1:]
	c = int(a)+int(b)
	d = 1
	while(int(c/10) != 0):
		d += 1
		c = int(c/10)
	print(d)
W, H, N = [int(x) for x in input().strip().split()]
x_min = 0
y_min = 0

for i in range(N):
    x, y, a = [int(x) for x in input().strip().split()]
    result = 0
    if W < x_min or H < y_min:
        W - x_min == 0
        continue

    if a == 1 and x_min < x:
        x_min = x
    elif a == 2 and W > x:
        W = x
    elif a == 3 and y_min < y:
        y_min = y
    elif a == 4 and H > y:
        H = y
    
print((W - x_min)*(H - y_min))

### FIXED CODE ###

a, b, c = list(map(int, input().split()))

if a+b==c or a+c==b or b+c==a:
    print('Yes')
else:
    print('No')
s=input().split()
a,b=int(s[0]),int(s[1])
print("{} {} {}".format(a//b,a%b,a/b)


### FIXED CODE ###

a,b=map(int,input().split())
print(a//b,a%b,"{:.5f}".format(a/b))
a,b=input()
if a*b/2==0:
  print("Even")
else:
  print("Odd")


### FIXED CODE ###

a,b = map(int,input().split())

if a*b%2 == 0:
  print("Even")
else:
  print("Odd")
N = int(input())

products = []

for i in range(1,10):
    for j in range(1,10):
        products.append(i*j)

if N in products:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

if A < 10 and B < 10:
    print(A*B)
else:
    print(-1)
import numpy as np
n = int(input())
ans = 1
for i in range(1,n+1):  
    if(i%2==0):
        continue
    count=0
    for j in range(1,i+1):
        if(i%j == 0):
            count += 1
    if(count == 7):
            ans+=1
print(ans)

import numpy as np
n = int(input())
ans =0
for i in range(1,n+1):  
    if(i%2==0):
        continue
    count=0
    for j in range(1,i+1):
        if(i%j == 0):
            count += 1
    if(count == 7):
            ans+=1
print(ans)




### FIXED CODE ###

import numpy as np
n = int(input())
ans =0
for i in range(1,n+1):  
    if(i%2==0):
        continue
    count=0
    for j in range(1,i+1):
        if(i%j == 0):
            count += 1
    if(count == 8):
            ans+=1
print(ans)
from bisect  import bisect_left

n = int(input())
a = list(map(int,input().split()))
a.sort()
b = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 
     131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 
     67108864, 134217728, 268435456, 536870912]

t = []
bIdx = 0
for aa in a :
    while b[bIdx] <= aa:
        bIdx += 1   
    t.append(b[bIdx]-aa)
t.sort(reverse=True)


u = [0 for i in range(len(t))]

#print(a)        
#print(t)
sum = 0
for i in range (len(a)-1,-1,-1):
    k = bisect_left(a,t[i])
    #print(t[i],k)
    if a[k] == t[i] and u[k] == 0 and k < i:
        #print(a[i],t[i],i)
        sum += 1
        u[k] += 1
print(sum)

### FIXED CODE ###

from bisect  import bisect_left

n = int(input())
a = list(map(int,input().split()))
a.sort()
#print(a)

sum = 0
for i in range (len(a)-1,-1,-1):

    b = 1
    while b <= a[i]:
        b = b<<1
    t = b - a[i]
    #print("2^",t)

    k = bisect_left(a,t)
    if a[k] == t and k < i:
        sum += 1
        a[k] -= 0.1
        a[i] += 0.1
print(sum)
import sympy

pg = sympy.primerange(2, 100001)

x = int(input())

for p in pg:
    if p >= x:
        print(p)
        break


### FIXED CODE ###

import math

x = int(input())


def is_prime(n):
    if n < 2:
        return False
    if n % 2 == 0 and n > 2:
        return False
    return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2))


for n in range(100005):
    if n >= x and is_prime(n):
        print(n)
        break
a,b=(int(x) for x in input().split())
if a > b:
  print(count(a)).while i == b
else:
  print(count(b)).while i == a

### FIXED CODE ###

a,b=(int(x) for x in input().split())
i = 0
if a > b:
  while i < a:
    print(str(b), end="")
    i += 1
else:
  while i < b:
    print(str(a), end="")
    i += 1
#16
n = int(input())
s = [int(input()) for i in range(n)]

Max = sum(s)
s = list(set(s))

if Max%10 ==0:
    for i in range(n):
        Max -= s[i]
        if Max%10 !=0:
            break
    
    
print(Max)

### FIXED CODE ###

#16
n = int(input())
s = [int(input()) for i in range(n)]

Max = sum(s)
s.sort()

if Max%10 ==0:
    for i in range(n):
        if s[i]%10 != 0:
            Max -= s[i]
        if Max%10 !=0:
            break
if Max%10 == 0:
    Max = 0
    
print(Max)
h,w,d = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
q=int(input())
b=[list(map(int, input().split())) for i in range(q)]
import collections
from collections import defaultdict
x=defaultdict(int)



for i in range(h):
    for j in range(w):
        x[i,j]=a[i][j]
x1=sorted(x.items(),key=lambda x:x[1])

ans=[[0]*(-(h*w//-d)) for i in range(d)]


for i in range(d):
    count=0
    for j in range(1,-(h*w//-d)-1):
        count+=abs(x1[i+(j-1)*d][0][0]-x1[i+j*d][0][0])
        count+=abs(x1[i+(j-1)*d][0][1]-x1[i+j*d][0][1])
        ans[i][j]+=count

for i in range(q):
    u=(b[i][0]-1)%d
    u1=(b[i][0]-u)//d
    v=(b[i][1]-b[i][0])//d

    print(ans[u][u1+v]-ans[u][u1])

### FIXED CODE ###

h,w,d = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
q=int(input())
b=[list(map(int, input().split())) for i in range(q)]
import collections
from collections import defaultdict
x=defaultdict(int)



for i in range(h):
    for j in range(w):
        x[i,j]=a[i][j]
x1=sorted(x.items(),key=lambda x:x[1])

ans=[[0]*(-(h*w//-d)) for i in range(d)]


for i in range(d):
    count=0
    for j in range(1,-(h*w//-d)):
        if i+j*d>=h*w:
            continue
        count+=abs(x1[i+(j-1)*d][0][0]-x1[i+j*d][0][0])
        count+=abs(x1[i+(j-1)*d][0][1]-x1[i+j*d][0][1])
        ans[i][j]+=count

for i in range(q):
    u=(b[i][0]-1)%d
    u1=(b[i][0]-1-u)//d
    v=(b[i][1]-b[i][0])//d

    print(ans[u][u1+v]-ans[u][u1])
str = raw_input()
q = input()
for ans in range(q):
    ans = raw_input()
    ans1 = ans.split(' ')
    if ans1[0] == 'replace':
        str = str[0:int(ans1[1])]+ans1[3]+ str[int(ans1[2])+1:len(str)]
    if ans1[0] == 'reverse':
        str = str[0:int(ans1[1])]+ans1[3]+str[int(ans1[1]):int(ans1[2])+1][::-1] + str[int(ans1[2])+1:len(str)]
    if ans1[0] == 'print':
        print str[int(ans1[1]):int(ans1[2])+1]

### FIXED CODE ###

str = raw_input()
q = input()
for ans in range(q):
    ans = raw_input()
    ans1 = ans.split(' ')
    if ans1[0] == 'replace':
        str = str[0:int(ans1[1])]+ans1[3]+ str[int(ans1[2])+1:len(str)]
    if ans1[0] == 'reverse':
        str = str[0:int(ans1[1])]+ str[int(ans1[1]):int(ans1[2])+1][::-1] + str[int(ans1[2])+1:len(str)]
    if ans1[0] == 'print':
        print str[int(ans1[1]):int(ans1[2])+1]
a=input()
x=int(a)

y=0
for i in len(n):
  y+=int(i)

if x % y==0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a=input()
x=int(a)

y=0
for i in a:
  y+=int(i)

if x % y==0:
  print('Yes')
else:
  print('No')
a,b = input().split()
S = a*b
C = 2 * (a+b)

print(S + " " + C)


### FIXED CODE ###

a,b = input().split()
a = int(a)
b = int(b)
S = a*b
C = 2 * (a+b)

print(str(S) + " " + str(C))
s=int(input())
i=4
while s>4or3==s:s=[s//2,s*3+1][s%2];i+=1
print(i)

### FIXED CODE ###

s=int(input())
i=2
while s>1:s=[s//2,s*3+1][s%2];i+=1
print(max(i,4))
n,m = map(int,input().split())
graph = {i:[] for i in range(1, n+1)}
for _ in range(m):
  a,b = map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)
for i in range(1, n+1):
  print(len(graphp[i]))

### FIXED CODE ###

n,m = map(int,input().split())
graph = {i:[] for i in range(1, n+1)}
for _ in range(m):
  a,b = map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)
for i in range(1, n+1):
  print(len(graph[i]))
int = int(input())
st = str(int)
chars = list(st)
if chars[0] == 7:
  print("Yes")
elif chars[1] == 7:
  print("Yes")
elif chars[2] == 7:
  print("Yes")
else print("No")

### FIXED CODE ###

int = int(input())
st = str(int)
chars = list(st)
if chars[0] == "7":
  print("Yes")
elif chars[1] == "7":
  print("Yes")
elif chars[2] == "7":
  print("Yes")
else:
  print("No")
inp=list(map(int,input().strip().split()))[:2]
n,r=inp[0],inp[1]
count=0
while(n > 0):
  n=n//r
  count+=1
return count


### FIXED CODE ###

inp=list(map(int,input().strip().split()))[:2]
n,r=inp[0],inp[1]
count=0
while(n > 0):
    n=n//r
    count+=1
print(count)