peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def main():
    N = int(input())
    power = 1

    for i in range(1,N+1):
        power *= i
        power %= (10**9) + 7

    return power

print(main())
# Judge status: Accepted
N = int(input())

S = []
for _ in range(N):
    tmp=sorted(input())
    S.append(tmp)

for i in range(len(S)):
    S[i]=''.join(S[i])

import collections
from math import factorial

res=0
dic = {}
for tmp in S:
    if tmp in dic.keys():
        res+=dic[tmp]
        dic[tmp]+=1
    else:
        dic[tmp]=1

print(int(res))
# Judge status: Accepted
#!/usr/bin/env python3
s = input()
print(s[:3])
# Judge status: Accepted
r=input()
g=input()
if r==g[::-1]:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
N=input()
if N.count("9")>=1:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n = int(input())
a = [0]+list(map(int,input().split()))
ans = [-1]*(n+1)
for i in range(n,0,-1):
    res = 0
    for j in range(i+i,n+1,i):
        res += ans[j]
    ans[i] = a[i]-(res%2)
p = []
for ind,v in enumerate(ans):

    if v== -1:continue
    if v == 1:p.append(ind)

print(len(p))
print(*p)
# Judge status: Wrong Answer
from collections import Counter

n, k = map(int, input().split())
s = list(map(int, input().split()))

num = Counter(s)

ans = 0
i = 0
if len(num) <= k:
    print(0)
else:
    cnt = len(num) - k

    for v in sorted(num.values()):
        if cnt == i:
            break
        ans += v
        i += 1

print(ans)
# Judge status: Wrong Answer
N,M = map(int,input().split())
PY = [list(map(int,input().split())) + [i] for i in range(M)]

PY.sort()
print(PY)

pnow = PY[0][0]
c = 1

ans = [-1 for i in range(M)]

for i in range(M):
    if pnow != PY[i][0]:
        c = 1
        pnow = PY[i][0]
    ans[PY[i][2]] = str(PY[i][0]).zfill(6) + str(c).zfill(6)
    c += 1

print('\n'.join(ans))
# Judge status: Accepted
A, B = list(map(int, input().split()))
print(A*B)
# Judge status: Accepted
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop
import itertools


#read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

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


for i in range(len(A)):
    a = ord(A[i])
    a += N
    #print(a)
    while(a > 90):
        a -= 26

    A[i] = chr(a)

print(''.join(A))
# Judge status: Accepted
A, B, C, D = map(int, input().split())
import fractions
g = fractions.gcd(C, D)
ac = (A-1)//C
bc = B//C
c = bc-ac
ad = (A-1)//D
bd = B//D
d = bd-ad
cdg = (C*D)//g
acd = (A-1)//cdg
bcd = B//cdg
cd = bcd-acd
ans = B-A+1-c-d+cd
print(ans)
# Judge status: Accepted
from collections import Counter
import math
import statistics
import itertools
a=input()
# b=input()
# c=[]
# for i in a:
#     c.append(int(i))
# A,B,C= map(int,input().split())
# f = list(map(int,input().split()))
# g = [input() for _ in range(a)]
# h = []
# for i in range(a):
#     h.append(list(map(int,input().split())))
# a = [[0] for _ in range(H)]#nizigen

if a[-1]=="s":
    print(a+"es")
else:
    print(a+"s")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cnt = min(a[0], b[0])
b[0] -= min(a[0], b[0])
for i in range(1, n):
    if b[i-1] > 0:
        cnt += min(a[i], b[i-1])
        a[i] -= b[i-1]
    if a[i] > 0:
        cnt += min(a[i], b[i])
        b[i] -= min(a[i], b[i])
cnt += min(a[-1], b[-1])
print(cnt)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
P=(sum(A))//N
P0=P-1
P1=P+1
M,M1,M0=0,0,0
for i in A:
  M+=(i-P)**2
  M1+=(i-P1)**2
  M0+=(i-P0)**2
print(min(M,M1,M0))
# Judge status: Accepted
N = int(input())
W =[ input()]
a = 'Yes'

for i in range(1,N):
    k = input()
    W.append(k)
    if W[-2][-1]!=k[0] or len(set(W))!=(i+1):
        a = 'No'
        break

print(a)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sum_a = sum(a)
for i in range(n):
    tmp = min(a[i], b[i])
    a[i] -= tmp
    b[i] -= tmp
    tmp = min(a[i + 1], b[i])
    a[i + 1] -= tmp
    b[i] -= tmp
ans = sum_a - sum(a)
print(ans)
# Judge status: Accepted
N = int(input())
lis1 = list(map(int,input().split()))
lis2 = list(map(int,input().split()))

sum1 = 0
sum2 = sum(lis2)
sum = 0

for j in range(N):
    sum1 += lis1[j]
    if not j == 0:
        sum2 -= lis2[j-1]
    if sum <= sum1 + sum2:
        sum = sum1 + sum2


print(sum)
# Judge status: Accepted
from collections import Counter
s = Counter(input())
if (s['N'] > 0) ^ (s['S'] > 0) or (s['E'] > 0) ^ (s['W'] > 0):
    print('No')
else:
    print('Yes')
# Judge status: Accepted
import collections


def main():
    N = int(input())
    S = [input()for n in range(N)]
    counter = [100] * 26
    for s in S:
        S_count = collections.Counter(s)
        for i in range(26):
            counter[i] = min(counter[i], S_count[chr(i + 97)])

    ans = ''
    for i in range(26):
        ans = ans + (chr(i + 97) * counter[i])
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n,k=map(int,input().split())
hoge=[0 for i in range(n)]
for i in range(k):
  aaa=int(input())
  huga=list(map(int,input().split()))
  for j in range(len(huga)):
    hoge[huga[j]-1]+=1
ans=0
for i in range(n):
  if(hoge[i]==0):
    ans+=1
print(ans)
# Judge status: Accepted
s = input()
count_a = s.count('a')
count_b = s.count('b')
count_c = s.count('c')
if abs(count_a - count_b) <= 1 and abs(count_b - count_c) <= 1 and abs(count_c - count_a) <= 1:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n = int(input())
l = [int(input()) for _ in range(n)]

from collections import Counter

x = 0
for i in Counter(l).values():
    if i%2 == 1:
        x += 1
print(x)
# Judge status: Accepted
s = input()
g = s[1:]
a = g.replace('9','')
if a == '':
  print(int(s[0])+(len(s)-1)*9)
elif len(s) == 1:
  print(s)
else:
  print(int(s[0])-1+9*(len(s)-1))
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
s = input()

if c < d:
    print("Yes" if s[a - 1:d].count("##") == 0 else "No")
    #aからd-1までで二個あるとあうと
else:
    print("Yes" if s[a - 1:c].count("##") ==
          0 and s[b - 2:d + 1].count("...") > 0 else "No")
          #b-1からd+1までで飛び越すの
# Judge status: Accepted
n, p = map(int, input().split())
a = list(map(int, input().split()))

cnt = 0
for num in a:
    if num % 2 == 1:
        cnt += 1

ans = 0
if cnt == 0:
    if p % 2 == 0:
        ans = 2**n
else:
    ans = 2**(n - 1)

print(ans)
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    N = int(input())

    ruiseki = 0
    ans = 0
    while ruiseki < N:
        ruiseki += ans
        ans += 1

    print(ans - 1)

    

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
alst = list(map(int, input().split()))
dp = [[1000, [0, 0]]]

for a in alst:
    tmp1 = max(dp[-1][0], dp[-1][1][0] * a + dp[-1][1][1])
    tmp2 = tmp1 // a
    tmp3 = tmp1 % a
    dp.append([tmp1, [tmp2, tmp3]])
print(dp[-1][0])
# Judge status: Accepted
K, A, B = map(int, input().split())

bisket = 1
money = 0

if B - A > 2:
    remain = K - A + 1
    bisket = A
    bisket += remain // 2 * (B - A)
    if remain % 2 == 1:
        bisket += 1
else:
    bisket += K

print(bisket)
# Judge status: Accepted
s = input()
for i in range(1,len(s)-1):
    t = s[:-i]
    if t[len(t)//2:] == t[:len(t)//2]:
        print(len(t))
        exit()
# Judge status: Wrong Answer
def prime(p):
    memo = []
    for i in range(2,(int(p**0.5)+1)):
        jousu = 1
        while p%(i**jousu)==0:
            p //= i**jousu
            memo.append(i**jousu)
            jousu += 1
    if p == n:
        memo.append(p)
    return memo
 
n=int(input())
 
memo = prime(n)

if len(memo) == 0:
  print(0)
else: 
  print(len(memo))
# Judge status: Wrong Answer
N,M,K = map(int,input().split())
ans = 'No'
for n in range(N):
    for m in range(M):
        tmp = ((N-n)*m + (M-m)*n)
        if tmp==K:
            ans = 'Yes'
print(ans)
# Judge status: Accepted
N,T = map(int,input().split())

INF = 10**9

min_cost = INF
for _ in range(N):
  c,t = map(int,input().split())
  if t <= T:
    min_cost = min(min_cost,c)

answer = min_cost if min_cost < INF else 'TLE'
print(answer)
# Judge status: Wrong Answer
import math
N,M=map(int,input().split())
if N==1:
  print(M)
else:
  ans=0
  a=M/N
  for i in range(int(math.sqrt(M))+1,0,-1):
    if M%i==0 and a>=i:
      print(i)
      break
# Judge status: Accepted
n = int(input())
s = [int(input()) for _ in range(n)]
if (sum(s)%10!=0):
    print(sum(s))
else:
    s.sort()
    for i in s:
        if (i%10!=0):
            print(sum(s)-i)
            exit()
    print(0)
# Judge status: Wrong Answer
a,b = map(int,input().split())
if((a + b) % 2 == 0):
    print((a + b) / 2)
else:
    print('IMPOSSIBLE')
# Judge status: Accepted
#from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

t = ins()
s = t.replace('?','D')
print(s)
# Judge status: Wrong Answer
def probB():
    S = input()
    T = input()

    if T in S:
        print(0)
        return

    maxequal = 0
    for i in range(len(S) - len(T)):
        count = 0
        for j in range(len(T)):
            if S[i + j] == T[j]:
                count += 1
            if (count > maxequal):
                maxequal = count
    print(len(T) - maxequal if maxequal > 0 else 0)

def main():
    probB()


if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
import math
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
s=input()
if s.isupper():
    print("A")
else:
    print("a")
# Judge status: Accepted
C = input()
print(chr(ord(C) + 1))
# Judge status: Wrong Answer
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))
import numpy as np

k,n = mi()
a=np.array(li())

b = a[1:] - a[:n-1]
b_max = np.max(b)
c = a[0] + k-a[n-1]

print(max(b_max,c))
# Judge status: Wrong Answer
s, w = input('').split()
if s >= w:
	print('safe')
else:
	print('unsafe')
# Judge status: Wrong Answer
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

d = defaultdict(int)
n = readInt()
for i in readChars():
	d[i]+=1

d = [i for i in sorted(d.items(), reverse=True) if i[1]>1]

try:
	if d[0][1]>=4:
		print(int(d[0][0])*2)
	else:
		print(int(d[0][0])*int(d[1][0]))
except:
	print(0)
# Judge status: Wrong Answer
import math
N = int(input())
max_quo = float('inf')
max_mod = 0

for i in range(1, int(math.sqrt(N))):
    if N%i == 0 and (N//i) < max_quo:
        max_quo = N//i
        max_mod = i
    elif max_quo < max_mod:
        break

print(max_quo + max_mod - 2)
# Judge status: Wrong Answer
n, m = map(int,input().split())
l = list(map(int,input().split()))

import math

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x%y)
def lcm(x, y):
    return x * y / gcd(x, y)

ans = 1
tf = True

for i in l:
    i /= 2
    ans = lcm(ans, i)
    if (ans / i) % 2 == 0:
        print(0)
        tf = False
        break
    if ans > m:
        print(0)
        tf = False
        break

if tf == True:
    print(math.ceil(m / (ans * 2)))
# Judge status: Accepted
L=list()
R=list()
T=0
N,M=map(int,input().split())
for i in range(N):
  A,B=map(int,input().split())
  L.append(A)
  R.append(B)
c = zip(L, R)
c=sorted(c)
L, R = zip(*c)
L=list(reversed(L))
R=list(reversed(R))
while True:
  c=L[-1]
  T+=c*min(M,R[-1])
  M-=min(M,R[-1])
  L.pop(-1)
  R.pop(-1)
  if M==0:
    break
print(T)
# Judge status: Accepted
import sys
import copy
s = int(input())

def f(n):
    if n%2==0:
        return int(n/2)
    else:
        return 3*n+1

for i in range(1000000):
    if i == 0:
        a=[s]
    else:
        a.append(f(a[i-1]))
    
    if a.count(a[i]) == 2:
        print(i+1)
        sys.exit(0)
# Judge status: Accepted
A,B,C,K = list(map(int, input().split()))

if(K<=A):
  print(K)
elif(K<=A+B):
  print(A)
else:
  print(A-(K-A-B))
# Judge status: Wrong Answer
s= input().split()
if int(s[0])>int(s[1])/2:
  print("safe")
else:
  print("unsafe")
# Judge status: Wrong Answer
# ABC137B

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

w1=0--W//2
w2=W//2

if H==1 or W==1:
    print(1)
else:
    print(w1*(0--H//2)+w2*(H//2))
# Judge status: Wrong Answer
a = list(map(int, input().split()))


if a[0] == a[1] and a[0] == a[2]:
   result = 2

elif a[0] == a[1] and a[0] != a[2]:
    result = 2
elif a[0] == a[2] and a[2] != a[1]:
    result = 2
elif a[1] == a[2] and a[2] != a[0]:
    result = 2
else:
    result = 3

print(result)
# Judge status: Accepted
d = int(input())

ans = "Christmas"
ans += " Eve" * (25-d)

print(ans)
# Judge status: Accepted
n , d =map(int,input().split())
x = [list(map(int,input().split())) for i in range(n)]
count = 0
for i in range(n):
    for j in range(i + 1, n):
        s = 0
        for k in range(d):
            s += (x[i][k] - x[j][k])**2
        s = s ** 0.5
        if int(s) == s:
            count += 1
print(count)
# Judge status: Wrong Answer
import bisect
n = int(input())
l = sorted(list(map(int, input().split())))

ans = 0
for i in range(n-1):
  for j in range(i+1, n):
    tmp = l[i] + l[j]
    
    d = bisect.bisect_left(l, tmp) - bisect.bisect_right(l, l[j])
    ans += d
    
print(ans)
# Judge status: Wrong Answer
def main():
    mod = 1000000007
    N, M, *A = map(int, open(0).read().split())
    A = set(A)
    F = [0] * (N + 1)
    F[0] = 1
    if 1 in A:
        F[1] = 1
    for i in range(2, N + 1):
        if i not in A:
            F[i] = (F[i-1] + F[i-2]) % mod
    print(F[N])


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n, m = map(int, input().split())
l = []

for i in range(m):
    p, y = input().split()
    l.append([p, y, m])

l.sort()

l[0][1] = 1

for i in range(1, m):
    if l[i][0] == l[i - 1][0]:
        l[i][1] = l[i - 1][1] + 1
    else:
        l[i][1] = 1

sortthird = lambda val: val[2]
l.sort(key = sortthird)


for i in l:
    ans = "0"*(6 - len(i[0])) + i[0] + "0"*(6 - len(str(i[1]))) + str(i[1])
    print(ans)
# Judge status: Wrong Answer
d = input()
if d == "25":
  print("Christmas")
elif d == "24":
  print("Christmas eve")
elif d == "23":
  print("Christmas eve eve")
else:
  print("Christmas eve eve eve")
# Judge status: Wrong Answer
x, a, b = map(int, input().split())

if abs(a - x) < abs(a - b):
    print('A')
else:
    print('B')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

for count in A :
    if count % 2 == 0:
        if count % 3 != 0 and count %5 != 0:
            print("DENIED")

        else:
            print("APPROVED")
# Judge status: Accepted
S = input()

print('2018' + S[4:])
# Judge status: Wrong Answer
from sys import stdin

n,c,k = [int(x) for x in stdin.readline().rstrip().split()]
li = [int(stdin.readline().rstrip()) for _ in range(n)]
li.sort()
time = li[0]
people = 1
bus_num = 1

for i in li:
    if i-time > k or people > c:
        bus_num += 1
        time = i
        people = 1
        continue
    people += 1
print(bus_num)
# Judge status: Wrong Answer
S = input()
l = len(S)
dp = [[0]*2 for _ in range(l+1)]
for i in range(l):
  dp[i+1][0]=min(dp[i][1]+10-int(S[i]),dp[i][0]+int(S[i]))
  dp[i+1][1]=min(dp[i][1]+10-int(S[i])-1,dp[i][0]+int(S[i])+1)
if int(S[0])>=4:
  print(dp[-1][0]+1)
else:
  print(dp[-1][0])
# Judge status: Accepted
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    from itertools import accumulate
    Sa = list(accumulate(A))
    Sb = list(accumulate([0] + B))
    ans = 0
    for i in range(N):
        cur = Sa[i] + (Sb[N] - Sb[i])
        ans = max(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, M = mapint()
AB = [list(mapint()) for _ in range(N)]
CD = [list(mapint()) for _ in range(M)]

for a, b in AB:
    dist = 10**18
    ans = -1
    for i in range(M):
        c, d = CD[i]
        if abs(a-c)+abs(b-d)<dist:
            ans = i+1
            dist = abs(a-c)+abs(b-d)
    print(ans)
# Judge status: Accepted
lis = list(map(int,input().split()))

if sum(lis) >=22:
    print("bust")
else:
    print("win")
# Judge status: Accepted
sx,sy,tx,ty=map(int,input().split())

dx=tx-sx
dy=ty-sy

root=""
for i in range(dy):
    root=root+"U"
for i in range(dx):
    root=root+"R"
for i in range(dy):
    root=root+"D"
for i in range(dx):
    root=root+"L"
    
root=root+"L"
for i in range(dy+1):
    root=root+"U"
for i in range(dx+1):
    root=root+"R"
root=root+"D"

root=root+"R"
for i in range(dy+1):
    root=root+"D"
for i in range(dx+1):
    root=root+"L"
root=root+"U"

print(root)
# Judge status: Accepted
n = int(input())

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

L = sorted(L,reverse=True)
#print(L)
#print(sum(L)) 
if sum(L)-L[0]*2>0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = list(input())
s.sort()
a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'r', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for i in a:
    if i not in s:
        print(i)
        exit()
print('None')
# Judge status: Accepted
n,a,b = map(int,input().split())
s = input()
a_, b_ = 0, 0
for i in range(n):
    if s[i]=='a':
        if (a_ + b_) < a+b:
            a_ += 1
            print('Yes')
        else:
            print('No')
    elif s[i]=='b':
        if (a_ + b_ ) < a+b and b_ < b:
            b_ += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')
# Judge status: Wrong Answer
N = input()
x = int(N)
y = (x*(x-1)*(10**(x-2))) % (10**9+7)
print(y)
# Judge status: Wrong Answer
n = int(input())
x = 0
mn = 100
for i in range(n):
  s = int(input())
  x += s
  if x % 10 != 0:
    if s <= mn:
      mn = s
if x % 10 != 0:
  print(x)
else:
  x -= mn
  if x % 10 == 0:
    print(0)
  else:
    if x < 0:
      print(0)
      exit()
    print(x)
# Judge status: Accepted
import math
R=int(input())
print(R*2*math.pi)
# Judge status: Accepted
h = int(input())
w  = int(input())
n = int(input())
print((n-1)//max([h,w])+1)
# Judge status: Accepted
S,T = input().split()
print(T+S)
# Judge status: Accepted
import bisect

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

ans=0
for i in range(N-2):
  for j in range(i+1,N-1):
    #small = bisect.bisect_left(L, L[j]-L[i])
    large = bisect.bisect_left(L, L[j]+L[i])    
    #print(i,j,L[i],L[j],"  ",L[j]-L[i],L[j]+L[i],small,large)
    ans += max(large-j-1,0)    

print(ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
if a<=c and c<=b:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
#入力例は合うがWAになる

S = str(input())
T = str(input())

if [S[0],S[1],S[2]] == [T[2],T[1],T[0]]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
q = [int(input())  for i in range(n)]
cnt = 0
ind = 0
for i in range(n):
  m = q[ind]-1
  if ind+1 == q[m]:
    print(-1)
    exit()
  ind = q[ind]-1
  cnt += 1
  if ind == 1:
    print(cnt)
    break
# Judge status: Wrong Answer
N, M, X, Y = map(int, input().split())
x = sorted(list(map(int, input().split())))
y = sorted(list(map(int, input().split())))

flag = True
if Y <= X:
    flag = False

if y[0] <= x[-1]:
    flag = False

if flag:
    print("No War")
else:
    print("War")
# Judge status: Accepted
N, K = [int(i.strip()) for i in input().split(' ')]
MOD = 10 **9 + 7
count = 0
for i in range(K,N+2):
    MIN = i * (i-1)/2
    MAX = N * i -MIN
    c = MAX -MIN + 1
    count += int(c)

print(count%MOD)
# 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())
c1 = S()
c2 = S()
if c1 == c2[::-1]:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
x=int(input())
ans=0
a=0
for i in range(1,x+1):
  a+=i
  ans+=1
  if a>=x:
    print(ans)
    break
# Judge status: Accepted

import bisect
import numpy

n, m, k = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))

cost_a = numpy.insert(numpy.cumsum(a), 0, 0)
cost_b = numpy.insert(numpy.cumsum(b), 0, 0)

ans = 0
j =  len(cost_b) -1
for i in range(len(cost_a)):
    for j in range(j, -1, -1):
        if cost_a[i] + cost_b[j] <= k:
            ans  = i + j if ans < i + j else ans
            break
print(ans)
# Judge status: Wrong Answer
from math import sqrt
l = [-1]+[0]*10**4
n = int(input())
for i in range(1,int(sqrt(n))+2):
    for j in range(1,int(sqrt(n))+2):
        for k in range(1,int(sqrt(n))+2):
            ans = i**2+j**2+k**2+i*j+j*k+k*i
            if ans <= 10*4:
                l[ans] += 1
for i in range(1,n+1):
    print(l[i])
# Judge status: Accepted
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    print(sum(
        1
        for i in range(A, B + 1)
        if str(i) == str(i)[::-1]
    ))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())

dp = list(range(0, N+1))

for i in range(1, N+1):
    for j in [6, 9]:
        for k in range(1, N):
            if 0 <= i-j**k:
                dp[i] = min(dp[i], dp[i-j**k]+1)
            else:
                break

print(dp[-1])
# Judge status: Accepted
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    a, b, c, d = Input()

    if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
        print("Yes")
    else:
        print("No")


main()
# Judge status: Accepted
from collections import Counter
N = int(input())
A = [None for i in range(N)]
for i in range(N):
  A[i] = input()
A = Counter(A)
keyA = list(A.keys())
valuesA = list(A.values())
most = max(valuesA)

ans = [None for _ in range(N)]
for i in range(len(valuesA)):
  if valuesA[i] == most:
    ans[i] = keyA[i]
ans = [a for a in ans if type(a) == str]
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[i])
# Judge status: Accepted
N, L = map(int, input().split())
s = [input() for i in range(N)]
s2 = sorted(s)
ans = ""
for i in range(N):
    ans += s2[i]
print(ans)
# Judge status: Wrong Answer
n = int(input())
ls = []
count = 0
for x in range(n):
    ls.append(input())
set(ls)
print(len(ls))
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, K = mapint()
As = list(mapint())
from itertools import accumulate

for _ in range(K):
    lamps = [0]*N
    for i, a in enumerate(As):
        lamps[max(0, i-a)] += 1
        if i+a+1<=N-1:
            lamps[i+a+1] -= 1
    As = list(accumulate(lamps))
    if sum(As)==N**2:
        break
print(*As)