peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import collections

s = list(input())
s_count = collections.Counter(s)
max_s = min(s_count[">"], s_count["<"])
ans = sum(range(1, max_s + 1))
print(ans)
# Judge status: Accepted
from collections import defaultdict

n = int(input())
arr = list(map(int, input().split()))

d = defaultdict(int)

for x in arr:
    d[x] += 1
    d[x - 1] += 1
    d[x + 1] += 1

result = [y for x, y in d.items()]

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

if n == 1:
  print(0)
else:
  print(1)
# Judge status: Wrong Answer
# coding: utf-8
import math

a, b = map(int, input().split())
ans = 0
consent = 0
plusplug = a - 1
if a >= b:
    print(1)
else:
    while consent <= b:
        consent += plusplug
        ans += 1
    print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
p = list(map(int, input().split()))
a = sum(p[0:k])
l = [a]
for i in range(n-k):
    a = a-p[i]+p[i+k]
    l.append(a)
print((max(l)+k)/2)
# Judge status: Accepted
n, x = map(int, input().split())

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

actions = 0

for a in range(1, n):
    diff = alist[a] + alist[a - 1] - x
    if diff > 0:
        actions += diff
        alist[a] = max(0, alist[a] - diff)

print(actions)
# Judge status: Accepted
from sys import stdin

def main():
    word = stdin.readline()
    max = 0
    count = 0
    for i in range(len(word)):
        if word[i] == "A" or word[i] == "C" or word[i] == "G" or word[i] == "T":
            count += 1
        elif max < count:
            max = count
            count = 0
    print(max)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n, k = map(int, input().split())
import math

print(math.floor(math.log(n, k)) + 1)
# Judge status: Accepted
K = int(input())
S = input()

if len(S) <= K:
    print(S)
else:
    print(S[0:K] + '...')
# Judge status: Accepted
N,K = map(int,input().split())
A = list(map(int,input().split()))

dic={}
for i in A:
    if i not in dic.keys():
        dic[i]=1
    else:
        dic[i]+=1
dic=sorted(dic.items(),key=lambda x:x[1],reverse=True)
k=0
ans=0
for key,value in dic:
    if k>=K:
        ans+=value
    k+=1
print(ans)
# Judge status: Accepted
S,m=input(),10000
for i in range(len(S)-2):m=min(m,abs(753-int(S[i:i+3])))
print(m)
# Judge status: Accepted
n=int(input())
arr=list(map(int,input().split()))

x=0

for i in arr:
	x^=i


ans=[]

for i in arr:
	ans.append(x^i)

print(*ans)
# Judge status: Accepted
N=int(input())
C=0
while N!=0:
    N=N//2
    C=C+1
A=[2**i for i in range(C)]
print(sum(A))
# Judge status: Accepted
n,k=map(int,input().split())

ans=0
while n!=0:
  ans+=1
  n//=k

print(ans)
# Judge status: Accepted
X = int(input())
number = X//100
teen = X%100

if teen <= 5*number:
    print(1)
else:
    print(0)
# Judge status: Accepted
N, A, B = [int(x) for x in input().split()]

if (B-A) % 2 == 0:
    print((B-A) // 2)
else:
    print(min(A-1, N-B) + 1 + (B - A - 1) // 2)
# Judge status: Accepted
d = {"Sunny":"Cloudy", "Cloudy":'Rainy', 'Rainy':'Sunny'}
print( d[input()])
# Judge status: Accepted
a=str(input())
if a[0] =='7' or a[1] =='7' or a[2]=='7':
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections


x = int(input())
for i in range(-1000,1001):
    for j in range(-1000,1001):
        if i**5 - j**5 == x:
            print(i,j)
            sys.exit()
# Judge status: Accepted
abc = list(map(int,input().split()))
abc.sort()
a = abc[0]
b = abc[1]
c = abc[2]
count = 0
x = c-b
a += x
b += x
count += x
if not (b-a) % 2 == 0:
    b += 1
    c += 1
    count += 1
x = (b-a)//2
a += (b-a)
count += x
print(count)
# Judge status: Accepted
N, A, B, C, D = map(int, input().split())
S = input()
for i in range(A - 1, max(C, D) - 1):
    if S[i] == S[i + 1] == '#':
        print("No")
        exit()

if C < D:
    print("Yes")
else:
    for i in range(B - 2, D - 1):
        if S[i:i + 3] == '...':
            print("Yes")
            exit()
    print('No')
# Judge status: Accepted
n = int(input())
t,a = map(int,input().split())
H = list(map(int,input().split()))
dic = {}

for i in range(n):
    dic[i+1] = abs(a-(t-H[i]*0.006))

print(min(dic,key=dic.get))
# Judge status: Accepted
n, m, x = map(int, input().split())

Book = [[int(x) for x in input().split()] for j in range(n)]
Cost = 10 ** 7
for i in range(2**n):
  bag = [0 for k in range(n+1)]
 
  for j in range(n):
    if ((i >> j) &1):
      bag = [ x + y for (x,y) in zip (bag,Book[j])]
  if all(b >= x for b in bag[1:]):
    if Cost >= bag[0]:
      Cost = bag[0]
if Cost != 10 ** 7:
  print(Cost)
else:
  print(-1)
# Judge status: Accepted
S = list(input())
USED = [False] * 26

for s in S:
  USED[ord(s)-97] = True
  
ok = False
ans = None
for i in range(26):
  if not USED[i]:
    ans = chr(97+i)
    ok = True
    break
    
if ok:
  print(ans)
else:
  print("None")
# Judge status: Wrong Answer
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
S = l()
S.sort()
ans1 = 0
ans2 = sum(S)
sa = 1000000000
i=0

for i in range(N):
    ans1 += S[i]
    ans2 -= S[i]
    sa = min(sa,abs(ans2-ans1))
    i += 1

print(sa)
# Judge status: Wrong Answer
# 数値の取得
polynum = int(input())
length = list(map(int,input().split()))

# 図形の成立可否を検証し結果を出力
most_l = max(length)
othersum = sum(length) - most_l
print(most_l)
print(othersum)
if othersum > most_l:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from fractions import gcd


def lcm(a, b):
    return a * b // gcd(a, b)


def solve(string):
    n, m, *a = map(int, string.split())
    c = 2**len(bin(a[0]).split("1")[-1])
    l = a[0]
    for _a in a:
        if _a % c or not _a // c % 2:
            return "0"
        l = lcm(l, _a)
    return str(max((m - l // 2) // l + 1, 0))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
# Judge status: Accepted
import sys
input = sys.stdin.readline
N = int(input())
v = [int(x) for x in input().split()]

v.sort()

ans = v[0]
for i in range(1,N) :
    ans = (ans + v[i])/2

print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
cnt = [0] * ((10**6)+1)

for elem in a:
    cnt[elem] += 1

unique = []

for i in range((10**6)+1):
    if cnt[i] == 1:
        unique.append(i)

cnt = [0] * ((10**6)+1)

a = list(set(a))

for elem in a:
    for m in range(elem*2, (10**6)+1, elem):
        cnt[m] = 1

ans = 0

for elem in unique:
    if cnt[elem] == 0:
        ans+=1

print(ans)
# Judge status: Accepted
L = [int(num) for num in input().split()]
K = int(input())
L.sort()
L[-1] = L[-1] * (2**K)
print(sum(L))
# Judge status: Accepted
s = input().split()
A = int(s[0])
B = int(s[1])
C = int(s[2])
K = int(input())

for i in range(K):
    if A >= B:
        B *= 2
    elif B >= C:
        C *= 2
    else:
        break

b = A < B < C

print('Yes' if b else 'No')
# Judge status: Accepted
import numpy as np
import fractions
from functools import reduce
N,X = map(int,input().split())
x = np.array([int(i) for i in input().split()],np.int64)
z = abs(X - x)
print(reduce(fractions.gcd,z))
# Judge status: Wrong Answer
#90
N = int(input())
p = 1
for i in range(1, N+1):
  p = p * i
  p = p % ((10e+9)+7)
print(int(p))
# Judge status: Accepted
a,b,x = list(map(int,input().split()))
import math
if x >= a*a*b/2:
  print(math.atan(2*(a*a*b-x)/(a*a*a)) * 180/math.pi)
else:
  print(math.atan(a*b*b/(2*x)) * 180/math.pi)
# Judge status: Accepted
s = input()
if s == "ABC":
    print("ARC")
else:
    print("ABC")
# Judge status: Wrong Answer
from sys import stdin
input = stdin.readline

L, N = map(int, input().split())
D = []

for i in range(N):
    D.append(input().strip())

D.sort()

print(''.join(D))
# Judge status: Wrong Answer
from collections import Counter
S = str(input())
S_ = Counter(S)
v,c =zip(*S_.most_common())
ans = 0
if len(c) == 1 and len(S) == 1:
  ans = 0
elif len(c) == 1 and len(S) > 1:
  ans = c[0]//2
elif len(c) > 1:
  ans = abs(c[1] - c[0] + 1)
print(ans)
# Judge status: Wrong Answer
A,B,C= map(int,input().split())

if A==B==C:
    print('-1')
else:
    cnt = 0

    flag = True
    while flag:
        A, B, C = (B+C)//2, (A+C)//2, (A+B)//2
        cnt += 1
        if A%2==0 and B%2==0 and C%2==0:    
            continue
        else:
            flag = False

    print(cnt)
# Judge status: Accepted
import math
n,d=map(int,input().split())
za=[list(map(int,input().split())) for i in range(n)]
ans=0
lon=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(d):
            lon+=(za[i][k]-za[j][k])**2
        else:
            lon=math.sqrt(lon)
            if lon==int(lon):
                ans+=1
            lon=0
print(ans)
# Judge status: Wrong Answer
hoge = int(input())
import math
print(math.floor(hoge/2))
# Judge status: Wrong Answer
n,k=list(map(int,input().split()))
s=0
for i in range(k,n+2):
	s+=i*(n+n-(i-1))/2+1-(i*(i-1))/2
print(s%(1000000007))
# Judge status: Accepted
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
D = {}
for i in range(N - 1):
    for j in range(i + 1, N):
        dist = min(j - i, abs(i - X) + 1 + abs(j - Y))
        if dist not in D:
            D[dist] = 1
        else:
            D[dist] += 1
for i in range(1, N):
    if i in D:
        print(D[i])
    else:
        print(0)
# Judge status: Accepted
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
mx = max(x)
my = min(y)
flag = False
for z in range(X+1,Y+1):
    if mx < z <= my:
        flag = True
        break
if flag:
    print('No War')
else:
    print('War')
# Judge status: Accepted
N,M= list(map(int,input().split()))
end = []
start = []
for i in range(M):
    A,B = list(map(int,input().split()))
    end.append(B)
    start.append(A)
end_min = min(end)
start_max = max(start)
if start_max > end_min:
    print(0)
else:
    print(end_min-start_max+1)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
L=[[0 for i in range(2)]for i in range(N)]
for i in range(N):
    L[i][0]=A[i]
    L[i][1]=i+1
L=sorted(L)

for i in range(N):
    print(L[i][1],end=" ")
# Judge status: Accepted
s = input()
ans = [0]*(len(s)+1)

for i in range(len(s)):
    if s[i] =='<':
        ans[i+1] = ans[i]+1
        
for i in range(len(s)-1,-1,-1):
    if s[i]=='>':
        ans[i]= max(ans[i],ans[i+1]+1)
print(sum(ans))
# Judge status: Accepted
n,m = map(int,input().split())
t = []
res = 0
for i in range(n):
    a,b = map(int,input().split())
    t.append((a,b))
t = sorted(t)
for i in range(n):
    if m > t[i][1]:
        res += t[i][0]*t[i][1]
        m -= t[i][1]
    else:
        res += t[i][0]*m
        break
print(res)
# Judge status: Accepted
A, B, C = sorted([int(x) for x in input().strip().split()])
print(A * B * (C % 2))
# Judge status: Accepted
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
n = int(input())
print(num2alpha(n).lower())
# Judge status: Wrong Answer
from sys import stdin
input=lambda : stdin.readline().strip()
from math import ceil,sqrt,factorial,gcd
n,k=map(int,input().split())
s=set()
for i in range(k):
	a=int(input())
	s.add(a)
	l=list(map(int,input().split()))
print(n-len(s))
# Judge status: Accepted
H1,M1,H2,M2,K = map(int, input().split())

t1 = H1 * 60 + M1
t2 = H2 * 60 + M2

if t2 - t1 <= K:
    print(0)
else:
    print(t2-t1-K)
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

pos = 0
visit = [0]*n
move = []
roop = []
while visit[pos] != 2:
    if visit[pos] == 0:
        move.append(pos)
    else:
        roop.append(pos)
    visit[pos] += 1
    pos = a[pos] - 1
if len(move) > k:
    print(move[k]+1)
else:
    print(roop[(k-(len(move)-len(roop))) % len(roop)]+1)
# Judge status: Accepted
n = int(input())
ans = 10**12
for i in range(1, int(n**0.5)+1):
    if n%i == 0:
        j = n//i
        ans = min(ans, i+j-2)
print(ans)
# Judge status: Accepted
L = int(input())

num = L // 3
rem = L % 3

if rem == 1:
    res = (num+1)*(num**2)

elif rem == 2:
    res = ((num + 1) ** 2) * num

else:
    res = num ** 3

res2 = (L/3)**3
if res > res2:
    print(res)
else:
    print(res2)
# Judge status: Accepted
def s(x):
    if x <= 9:
        return x
    else:
        return x % 10 + s(x // 10)


n, a, b = map(int, input().split())
ans = 0
for i in range(1, n + 1):
    if a <= s(i) <= b:
        ans += i
print(ans)
# Judge status: Wrong Answer
def main():
  s, k = input(), int(input())
  n = s.find('1') + 1
  	
  if n >= k:
    print(1)
  else:
    print(s[n])

if __name__ == '__main__':
  main()
# Judge status: Wrong Answer
sx,sy,tx,ty = map(int, input().split())
ans = ""
if sx > tx: ans += "L" * (sx-tx)
else: ans += "R" * (tx-sx)
if sy > ty: ans += "D" * (sy-ty+1)
else: ans += "U" * (ty-sy+1)

if sx > tx: ans += "R" * (sx-tx+1)
else: ans += "L" * (tx-sx+1)
if sy > ty: ans += "U" * (sy-ty+1)
else: ans += "D" * (ty-sy+1)

if sx > tx: ans += "L"
else: ans += "R" 

print(ans)
# Judge status: Accepted
n = int(input())
l = sorted(list(map(int, input().split())))

total = sum(l[:n - 1])

if total > l[n - 1]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
n = int(input())
s = list(input())

if (s.count("R") == 0 or s.count("W") == 0):
    print(0)
    sys.exit()

middle = int(len(s) // 2)

rr = s[middle:].count("R")
rw = len(s) - rr
lr = s[0:middle].count("R")
lw = len(s) - lr

if (rr == lw):
    print(rr)
    sys.exit()

if (rr > lw):
    print(lw)
    sys.exit()

if (rr < lw):
    print(rr)
    sys.exit()
# Judge status: Wrong Answer
i = list(map(int, input().split()))

x = 1/2*(i[1]-2*i[0])

if x < i[0]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    a, b, c, d, e, k = map(int, read().split())

    if e - a > k:
        print(':(')
    else:
        print('Yay!')

    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
s = input()
A, B, C, K = [int(v) for v in s.split(" ")]

if K <= A:
  print(K)
elif K <= A + B:
  print(A)
elif K <= A + B + C:
  print(A - (K - A - B))
# Judge status: Accepted
a,b = map(int,input().split())
if a*b<= 0:
  print('Zero')
elif a>0:
  print('Positive')
else:
  if (b-a)%2==0:
    print('Negative')
  else:
    print('Positive')
# Judge status: Accepted
N, M = map(int, input().split())

M_MAX = (N - 1) // 2

pos = 1
size = M_MAX
i = 0
while i < M and size > 0:
    print(pos, pos + size)
    pos += 1
    i += 1
    size -= 2

pos = 1 + M_MAX + 1
size = M_MAX - 1
while i < M and size > 0:
    print(pos, pos + size)
    pos += 1
    i += 1
    size -= 2
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    m = 0
    while i != 0:
        m += int(n % 10)
        i = i / 10
    if a <= m <= b:
        ans += m
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())

ans = min(N % K, abs(N % K - K))

print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))
tu=0
td=0
if k>=40:
  a=[n]*n
else:
  for j in range(k):
    temp=[0]*n
    for i in range(n):
      td=max(i+1-a[i],1)
      temp[td-1]=temp[td-1]+1
      tu=min(i+1+a[i],n)
      if tu!=n:
        temp[tu]=temp[tu]-1
    a[0]=temp[0]
    for i in range(1,n):
      a[i]=a[i-1]+temp[i]
L=[str(t) for t in a]
L=" ".join(L)
print(L)
# Judge status: Accepted
n = int(raw_input())
import sys
for i in xrange(350):
    for j in xrange(i):
        a = i - 175;
        b = j - 175
        if (a**5 - b**5) == n:
            print "{} {}".format(a, b)
            sys.exit(0)
# Judge status: Accepted
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
#from scipy.misc import comb

N,Q = map(int, input().split())
S = input()

L = []
R = []

for i in range(Q):
    l,r = map(int, input().split())
    L.append(l)
    R.append(r)

rs = [0,0]
cnt = 0
for i in range(1,N):
    if S[i-1]=='A' and S[i]=='C':
        cnt += 1
        rs.append(cnt)
    else:
        rs.append(cnt)

for i in range(Q):
    ans = rs[R[i]]-rs[L[i]]
    print(ans)
# Judge status: Wrong Answer
import sys

input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
r = 0
if len(set(a)) == 1:
    print(0)
    exit()

for i in a:
    for k in a:
        if i == k :
            continue
        if i % k == 0:
            r += 1
            break

print(n-r)
# Judge status: Accepted
string = input()
if string[-1] != 's':
  string = string + 's'
else:
  string = string + 'es'
print(string)
# Judge status: Accepted
A = input()
B = input()

ans = set('123')
ans.remove(A)
ans.remove(B)
print(tuple(ans)[0])
# Judge status: Wrong Answer
import math
N,a,b = map(int,input().split())
Sum = pow(2, N, 10**9+7)-1
def comb(n,k):
    m = n#分子
    l = 1 #bunnbo
    for i in range(k):
        m *= m-i
        l *= i+1
    return m / pow(l, 10**9+5, 10**9+7)

Sum = pow(2, N, 10**9+7) -1 - comb(N,a) - comb(N,b) 
Sum %= 10**9+7
print(Sum)
# Judge status: Wrong Answer
X,Y = map(int,input().split())
if Y % 2 !=0:
    a = "NO"
else:
    t = 2*X-Y/2
    k = Y/2-X
    if int(t)<0 or X<int(t):
        a = "No"
    elif int(k)<0 or X<int(k):
        a = "No"
    else:
        a = "Yes"
print(a)
# Judge status: Wrong Answer
N, K = map(int, input().split())
X = list(map(int, input().split()))
ans = 10000000000

for i in range(N-K+1):
    num = X[K+i-1] - X[i] + abs(X[i])
    if num < ans:
        ans = num
print(ans)
# Judge status: Accepted
def main():
    s = input()
    if s[-1] == 's':
        s += 'es'
    else:
        s += 's'
    print(s)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

ans = 0
while sum(A)%2 == 0:
    for i in range(N):
        A[i] = A[i]/2
    ans += 1

print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(1, n, 2):
    if a[i]%2 == 1:
        cnt += 1
print(cnt)
# Judge status: Accepted
A, B, K = map(int, input().split())

k = 0
for i in range(100, 0, -1):
  if A%i == B%i == 0:
    k += 1
    if k == K:
      print(i)
      quit()
# Judge status: Accepted
a, b, c, d = map(int, input().split())

if abs(a - c) <= d or abs(b - a) <= d and abs(c - b) <= d:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, K = map(int, input().split())
MOD = 10 ** 9 + 7

ans = 0
for k in range(K, N + 2):
    MIN = (k - 1) * k // 2 % MOD
    MAX = (2 * N - k + 1) * k // 2 % MOD
    ans += MAX - MIN + 1
    ans %= MOD

print (ans)
# Judge status: Wrong Answer
from sys import stdin


inp = stdin.readline

t = inp().strip()

if t[2] == t[3] and t[4] == t[5]:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
X=int(input())
ans=1
X_max=int(X**0.5)

for i in range(1,X_max+1):
    for j in range(1,X):
        if i**j <= X:
            ans=max(ans,i**j)
print(ans)
# Judge status: Accepted
import math
from functools import reduce

N = int(input())
S = [int(input()) for _ in range(N)]

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(S))
# Judge status: Accepted
import collections
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
col_A = collections.Counter(A)
lis_col_A=[]
for key,val in col_A.items():
    lis_col_A.append([key,val])
slcA = sorted(lis_col_A,key = lambda x:-x[1])
sumA = 0
for i in range(K,len(slcA)):
    sumA += slcA[i][1]
print(sumA)
# Judge status: Accepted
n = int(input())
s = input()

ans = 0

for i in range(n-1):
    left = s[0:i]
    right = s[i:n]

    sleft = set([x for x in left])
    sright = set([x for x in right])

    tmp = len(sleft & sright)
    if tmp > ans:
        ans = tmp

print(ans)
# Judge status: Accepted
def resolve():
    s = sorted(list(input()))
    t = sorted(list(input()), reverse=True)
    if s < t:
        print("Yes")
    else:
        print("No")


resolve()
# Judge status: Accepted
#h,w=map(int,input().split())
import string
al=string.ascii_lowercase
n=int(input())
ss=[]
for i in range(n):
    s=input()
    t=[]
    for i in al:
        t.append(s.count(i))
    ss.append(t)

ans=[]
for i in range(26):
    mi=10**10
    for j in ss:
        mi=min(j[i],mi)
    ans+=[mi]

t=''
for i in range(26):
    t+=al[i]*ans[i]
print(t)
# Judge status: Accepted
H,N=map(int,input().split())
A=list(map(int,input().split()))

if sum(A)>=H:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
#B
s = list(input())
left = int(s[0])*10+int(s[1])
right = int(s[2])*10+int(s[3])
print(left,right)
if 0 < left <= 12:
    if 0 < right <= 12:
        print("AMBIGUOUS")
    else:
        print('MMYY')
elif 0 < right <= 12:
    print('YYMM')
else:
    print('NA')
# Judge status: Accepted
k, x = map(int, input().split())
print("Yes") if k * 500 >= x else print("No")
# Judge status: Wrong Answer
n = int(input())
N = n//3
print(N*N*N)
# Judge status: Accepted
A, B, C = map(int, input().split())
print('Yes' if A-C>0 and C-B>0 or A-C<0 and C-B<0 else 'No')
# Judge status: Accepted
SX,SY,TX,TY=map(int,input().split())
dt={'U':'D','D':'U','L':'R','R':'L'}
def f(s):
 t=''
 for a in s:t+=dt[a]
 return t

vx=TX-SX
vy=TY-SY

ans1='U'*vy+'R'*vx
ans1+=f(ans1)
ans2='L'+'U'*(vy+1)+'R'*(vx+1)+'D'
ans2+=f(ans2)

print(ans1+ans2)
# Judge status: Wrong Answer
N,T=map(int,input().split())
cost=100
for s in range(N):
    c,t=map(int,input().split())
    if t<=T:
        if c<cost:
            cost=c
    else:
        continue
print(cost if cost!=100 else 'TLE')
# Judge status: Accepted
S = input()
print("x"*len(S))
# Judge status: Accepted
n = int(input())

n -= 1

a = []
while True:
  a.append(n % 26)
  n //= 26
  if not n:
    break
  n -= 1
name = ''.join([chr(ord('a') + c) for c in a])
print(name[::-1])
# Judge status: Wrong Answer
N = int(input())
A = [int(i) for i in input().split()]
su = 0

for i in range(0,N-1):
    for j in range(i+1,N):
        su += A[i]*A[j]
        print(i,j,A[i],A[j])

print(su)
# Judge status: Accepted
n = int(input())
l = []
flag = 0
for i in range(n):
    w = input()
    l.append(w)
for k in range(1,n):
    if  l[k-1][-1] != l[k][0]:
        flag =1
        break

    for j in range(k):
        if l[k] == l[j]:
            flag = 1
            break
        
if(flag == 1):
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
import collections

S = input()
T = input()

s_counter = collections.Counter(S)
t_counter = collections.Counter(T)

ans = "Yes"
for s, t in zip(s_counter.values(), t_counter.values()):
    if s != t:
        ans = "No"
        break
print(ans)
# Judge status: Wrong Answer
n = int(input())
List = list(map(int,input().split()))
counter = 0
min = max(List)
sum = 0
for item in List:
  if item < 0:
    counter += 1
  if abs(item) <= min:
    min = abs(item)
  sum += abs(item)

if counter %2 == 0:
  Answer = sum
else:
  Answer = sum -min*2

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

left = 0
p = 0
for i in range(n):
    if s[i] == '(':
        p += 1
    else:
        if p == 0:
            left += 1
        else:
            p -= 1
right = p

res = ""
for i in range(left):
    res += '('
res += s
for i in range(right):
    res += ')'
print(res)
# Judge status: Accepted
#!/us/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def main():
    a = input()
    if ord('a') <= ord(a) <= ord('z'):
        print("a")
    else:
        print("A")

    return


if __name__ == '__main__':
    main()