Harryxun/stf_run huggingface dataset:
import functools

def check(s):
    if len(s)==0 or len(s)==1:
        return 0
    head = s[0]
    tail = s[-1]
    if head ==tail:
        return check(s[1:-1])
    if head =="x":
        return 1+check(s[1:])
    if tail =="x":
        return 1+check(s[:-1])
    return -1

def main():
    n = check(input())
    print(n)

    # total = functools.reduce(lambda a, b: a * (2 if b % 2 == 1 else 1),A)
    # print(pow(3 ,len(A)-1)*total)
    # # print(123)
    # b = [int(a) for a in input().split(" ")]
    # print(b)
    # [input() for a in range(3)]


if __name__ == "__main__":
    main()


### FIXED CODE ###

import functools


def check(s):
    result = 0
    sss = s

    while True:
        if len(sss) <= 1:
            break
        head = sss[0]
        tail = sss[-1]
        if head == tail:
            sss = sss[1:-1]
            continue
        if head == "x":
            result += 1
            sss = sss[1:]
            continue
        if tail == "x":
            result += 1
            sss = sss[:-1]
            continue
        return -1
    return result

def main():
    n = check(input())
    print(n)

    # total = functools.reduce(lambda a, b: a * (2 if b % 2 == 1 else 1),A)
    # print(pow(3 ,len(A)-1)*total)
    # # print(123)
    # b = [int(a) for a in input().split(" ")]
    # print(b)
    # [input() for a in range(3)]


if __name__ == "__main__":
    main()
n, m, x = map(int, input().split())
c = [0] * n
a = [0] * n
for i in range(n):
    xs = list(map(int, input().split()))
    c[i] = xs[0]
    a[i] = xs[1:]
ans = 10 ** 9
for i in range(2 ** n):
    csum = 0
    asum = [0] * n
    for j in range(n):
        if (i >> j) & 1:
            csum += c[j]
            for k in range(m):
                asum[k] += a[j][k]
    if len(list(filter(lambda v: v >= x, asum))) == m:
        ans = min(ans, csum)
print(-1 if ans == 10 ** 9 else ans)


### FIXED CODE ###

n, m, x = map(int, input().split())
c = [0] * n
a = [0] * n
for i in range(n):
    xs = list(map(int, input().split()))
    c[i] = xs[0]
    a[i] = xs[1:]
ans = 10 ** 9
for i in range(2 ** n):
    csum = 0
    asum = [0] * m
    for j in range(n):
        if (i >> j) & 1:
            csum += c[j]
            for k in range(m):
                asum[k] += a[j][k]
    if len(list(filter(lambda v: v >= x, asum))) == m:
        ans = min(ans, csum)
print(-1 if ans == 10 ** 9 else ans)
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    A=LI()
    M=10**6+5
    dp=[1]*M
    A.sort()
    L=[A[0]]
    for i in range(1,N):
        if A[i]!=L[-1]:
            L.append(A[i])
        else:
            dp[A[i]]=0
            
    for i in range(len(L)):
        temp=L[i]*2
        if dp[temp]==1:
            while temp<M:
                dp[temp]=0
                temp+=L[i]
        
    ans=0        
    for i in range(len(L)):
        if dp[L[i]]==1:
            ans+=1
            
            
    

         
            
    print(ans)
                
    
    


main()


### FIXED CODE ###

import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    A=LI()
    M=10**6+5
    dp=[1]*M
    A.sort()
    L=[A[0]]
    L2=set([])
    for i in range(1,N):
        if A[i]!=L[-1]:
            L.append(A[i])
        else:
            L2.add(A[i])
            
    for i in range(len(L)):
        temp=L[i]
        if dp[temp]==1:
            temp+=L[i]
            while temp<M:
                dp[temp]=0
                temp+=L[i]
        
    ans=0    
    for i in L2:
        dp[i]=0
        
    for i in range(len(L)):
        if dp[L[i]]==1:
            ans+=1
            
            
    

         
            
    print(ans)
                
    
    


main()
import math
import fractions

def main():
    a, b, c, d = map(int, input().split())

    quotient = []
    temp_lcm = fractions.gcd(c, d) // c * d
    for i, x in enumerate([c, d, temp_lcm]):
        temp = (b // x) - ((a-1) // x)
        quotient.append(temp)
    temp1 = b - a + 1
    ans = temp1 - (quotient[0] + quotient[1]) + quotient[2]
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import math
import fractions

def main():
    a, b, c, d = map(int, input().split())

    quotient = []
    temp_lcm = c * d // fractions.gcd(c, d)
    for i, x in enumerate([c, d, temp_lcm]):
        temp = (b // x) - ((a-1) // x)
        quotient.append(temp)
    temp1 = b - a + 1
    ans = temp1 - (quotient[0] + quotient[1]) + quotient[2]
    print(ans)


if __name__ == '__main__':
    main()
X = int(input())
A = int(input())

if X < A:
 print(0)
else:
 print(10)

### FIXED CODE ###

X, A = map(int, input().split())
 
if X < A:
 print(0)
else:
 print(10)
import numpy as np
import sys
sys.setrecursionlimit(10**10)

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

a2 = []
for i in range(n):
    a2.append((a[i], i))
a2.sort(reverse=True)

dp = np.full((n, n, n), -1)


def solve(i2, s, e):
    if dp[i2][s][e] != -1:
        return dp[i2][s][e]

    a, i = a2[i2]

    if i2 == n-1:
        dp[i2][s][e] = a * abs(s-i)
        return dp[i2][s][e]

    dp[i2][s][e] = max(solve(i2+1, s+1, e) + a * abs(s - i),
                       solve(i2+1, s, e-1) + a * abs(e - i))

    return dp[i2][s][e]


print(solve(0, 0, n-1))


### FIXED CODE ###

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

a2 = []
for i in range(n):
    a2.append((a[i], i))
a2.sort(reverse=True)

dp = [[-1] * n for _ in range(n)]
for i2 in range(n-1, -1, -1):
    a, i = a2[i2]

    for s in range(i2+1):
        if i2 == n-1:
            dp[i2][s] = a * abs(s-i)
        else:
            dp[i2][s] = max(dp[i2+1][s+1] + a * abs(s - i),
                            dp[i2+1][s] + a * abs(n-1-i2+s - i))

print(dp[0][0])
from math import gcd 
def ma():
    return map(int,input().split())
N,M=ma()
A=list(ma())
temp=A[0]//2

for i in range(N-1):
    temp=temp*(A[i+1]//2)//gcd(temp,(A[i+1]//2))
M+=temp 
ans=M//(2*temp)
print(ans)

### FIXED CODE ###

import numpy as np
from fractions import gcd
def lcm(a,b):
  return a*b//gcd(a,b)
N,M=map(int,input().split())
a=[i//2 for i in map(int,input().split())]
b=np.array(a)
cnt=0
while all(b%2==0):
  b//=2
if any(b%2==0):
  print(0)
  exit()
ans=1
for i in a:
  ans=lcm(ans,i)
print((M//ans+1)//2)
x = input()

print(x**3)

### FIXED CODE ###

x = input()
print(int(x) ** 3)
N,M,K=map(int,input().split())
par=[i for i in range(N+10)]
siz=[1 for i in range(N+10)]
fre=[0 for i in range(N+10)]
blo=[0 for i in range(N+10)]
rank=[0 for i in range(N+10)]

def find(x):
    if(par[x]==x):
        return x
    else:
        par[x]=find(par[x])
        return par[x]

#木をつなぐ
def union(a,b):
    a=find(a)
    b=find(b)
    if(a==b):
        return 0
    else:
        par[a]=b
        siz[b]+=siz[a]

def size(a):
    return siz[find(a)]

def same(a,b):
    return find(a)==find(b)

for i in range(M):
    A,B=map(int,input().split())
    union(A,B)
    fre[A]+=1
    fre[B]+=1
for i in range(K):
    C,D=map(int,input().split())
    if(same(C,D)):
        blo[C]+=1
        blo[D]+=1

for i in range(1,N+1):
    print(size(i)-fre[i]-blo[i]-1,end=' ')

### FIXED CODE ###

N,M,K=map(int,input().split())
par=[i for i in range(N)]
siz=[1 for _ in range(N)]
rank=[0 for _ in range(N)]

def find(x):
    if(par[x]==x):
        return x
    else:
        par[x]=find(par[x])
        return par[x]

def union(a,b):
    a=find(a)
    b=find(b)
    if(a==b):
        return 0
    else:
        if rank[a]>rank[b]:
            par[b]=a
            siz[a]+=siz[b]
        else:
            par[a]=b
            siz[b]+=siz[a]
            if rank[a]==rank[b]:
                rank[b]+=1
            

def size(a):
    return siz[find(a)]

def same(a,b):
    return find(a)==find(b)

ans=[0 for i in range(N)]
for _ in range(M):
    A,B=map(int,input().split())
    A,B=A-1,B-1
    union(A,B)
    ans[A]-=1
    ans[B]-=1
for i in range(N):
    ans[i]+=size(i)-1
for _ in range(K):
    C,D=map(int,input().split())
    C,D=C-1,D-1
    if(same(C,D)):
        ans[C]-=1
        ans[D]-=1
        
print(*ans)
a, b = list(input().split())
if a <= b:
  print(a)
else:
  print(a-1)

### FIXED CODE ###

a, b = [int(ab) for ab in input().split()]
if a <= b:
  print(a)
else:
  print(a-1)
import numpy as np

(N, M) = map(int, raw_input().split())
cakes = [map(int, raw_input().split()) for i in xrange(N)]
cakes_p = np.array(sorted(cakes, key=lambda x: sum(x))[::-1])
cakes_nx = np.array(sorted(cakes, key=lambda x: sum(x) - 2 * x[0])[::-1])
cakes_ny = np.array(sorted(cakes, key=lambda x: sum(x) - 2 * x[1])[::-1])
cakes_nz = np.array(sorted(cakes, key=lambda x: sum(x) - 2 * x[2])[::-1])
cakes_list = [cakes_p, cakes_nx, cakes_ny, cakes_nz, cakes_p[::-1], cakes_nx[::-1], cakes_ny[::-1], cakes_nz[::-1]]
value = max([sum(map(abs,sum(cake[:M]))) for cake in cakes_list])

print value

### FIXED CODE ###

import numpy as np

(N, M) = map(int, raw_input().split())
cakes = [map(int, raw_input().split()) for i in xrange(N)]
cakes_p = np.array(sorted(cakes, key=lambda x: sum(x))[::-1])
cakes_nx = np.array(sorted(cakes, key=lambda x: sum(x) - 2 * x[0])[::-1])
cakes_ny = np.array(sorted(cakes, key=lambda x: sum(x) - 2 * x[1])[::-1])
cakes_nz = np.array(sorted(cakes, key=lambda x: sum(x) - 2 * x[2])[::-1])
cakes_list = [cakes_p, cakes_nx, cakes_ny, cakes_nz, cakes_p[::-1], cakes_nx[::-1], cakes_ny[::-1], cakes_nz[::-1]]
value = max([sum(map(abs,sum(cake[:M]))) for cake in cakes_list]) if M != 0 else 0

print value
N,K = map(float,input().split())
P = list(map(float,input().split()))


Psoat = sorted(P, reverse=True)

ans = 0
for i in range(K):
    ans = ans+Psoat[i]*0.5+0.5
    

print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
P = list(map(float,input().split()))

wa = float(0)
for i in range(K):
    wa = wa + P[i]

ans = wa 
  
repeat = N-K
for i in range(repeat):
    wa = wa + P[i+K]-P[i]
    if ans <= wa :
        ans = wa
      
print(ans/2+(K*0.5))
N, M = map(int, input().split())

if N != 0 and M != 0:
  answer = N(N-1)/2 + M(M-1)/2
  print(answer)
elif N == 0:
  answer = M(M-1)/2
  print(answer)
else:
  answer = N(N-1)/2
  print(answer)

### FIXED CODE ###

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

if N != 0 and M != 0:
  answer = N*(N-1)/2 + M*(M-1)/2
  print(int(answer))
elif N == 0:
  answer = M*(M-1)/2
  print(int(answer))
else:
  answer = N*(N-1)/2
  print(int(answer))
if __name__ == "__main__":
  list_N_M = input().split(' ')
  N = int(list_N_M[0])
  M = int(list_N_M[1])
  
  list_str_H_all = input().split(' ')
  H = [0.0] * N
  for i in range(len(list_str_H_all)):
    H[i] = float(list_str_H_all[i])
  
  is_good_vp = [True] * N
  
  for _ in range(M):
    str_A_B = input().split(' ')
    A = int(str_A_B[0])
    B = int(str_A_B[1])
    
    if H[A-1] > H[B-1]:
      is_good_vp[B-1] = False
    elif H[B-1] > H[A-1]:
      is_good_vp[A-1] = False
    
  output = 0
  for i in N:
    if is_good_vp[i]:
      output += 1
      
  print(output)

### FIXED CODE ###

if __name__ == "__main__":
  list_N_M = input().split(' ')
  N = int(list_N_M[0])
  M = int(list_N_M[1])
  
  list_str_H_all = input().split(' ')
  H = [0] * N
  for i in range(len(list_str_H_all)):
    H[i] = int(list_str_H_all[i])
  
  is_good_vp = [True] * N
  
  for _ in range(M):
    str_A_B = input().split(' ')
    A = int(str_A_B[0])
    B = int(str_A_B[1])
    
    if H[A-1] > H[B-1]:
      is_good_vp[B-1] = False
    elif H[B-1] > H[A-1]:
      is_good_vp[A-1] = False
    else:
      is_good_vp[A-1] = False
      is_good_vp[B-1] = False
    
  output = 0
  for i in range(N):
    if is_good_vp[i]:
      output += 1
      
  print(output)
li=[input() for i in range(4)]

while ((li[0]>0) and (li[2]>0)):
  li[2]=li[2]-li[1]
   if li[2]<=0:
      print('Yes')
  li[0]=li[0]-li[3]
   if li[0]<=0:
      print('No')

### FIXED CODE ###

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

A=li[0]
B=li[1]
C=li[2]
D=li[3]

while ((A>0) and (C>0)) :
  C=C-B
  if C<=0:
    print('Yes')
    break
  A=A-D
  if A<=0:
    print('No')
    break
x = int(input())

if(x == 0):
    print('1')
elif(x == 1):
    print('0')
else:

### FIXED CODE ###

x = int(input())

if(x == 0):
    print('1')
elif(x == 1):
    print('0')
else:
    pass
from bisect import bisect

n=int(input())
a=[0]*n
for i in range(n):
   a[i]=int(input())

def loopa():

    n=len(a)
    dp = [10**10]*(n+1)
    dp[0] = -1
    dq = [0]*(n+1)    
    
#    print(n,a,dp)
    for i in range(n):
        idx = bisect(dp, a[i]-1)
        if dp[idx]==10**10:
#            dp[idx] = min(a[i], dp[idx])
            if dp[idx]>a[i]:
                dp[idx]=a[i]
                dq[idx]=i
            dp2=dp[1:idx+1]
            dq2=dq[1:idx+1]
        else:
#            dp[idx] = min(a[i], dp[idx])
            if dp[idx]>a[i]:
                dp[idx]=a[i]
                dq[idx]=i

    for i in range(len(dq2)-1,-1,-1):
        del a[dq2[i]]
#        print("i:",i,"a:",a,"dp2:",dp2)            

icnt=0
while len(a)>0:
    loopa()        
    icnt+=1

print(icnt)    

### FIXED CODE ###

from bisect import bisect

icase=1
if icase==1:
    n=int(input())
    a=[0]*n
    for i in range(n):
        a[i]=-int(input())
elif icase==2:
    n=5
    a=[-2,-1,-4,-5,-3]
elif icase==3:
    n=4
    a=[0,0,0,0]

def loopa():

    n=len(a)
    dp = [10**10]*(n+1)
    dp[0] = -10**10
    
    for i in range(n):
#        idx = bisect(dp, a[i]-1)
        idx = bisect(dp, a[i])
        dp[idx] = min(a[i], dp[idx])

#        print("i:",i,"a:",a,"dp2:",dp2)            
    return dp

dp=loopa()        

print(bisect(dp, 10**10-1)-1)
from collections import deque
import sys
def input():
    return sys.stdin.readline()[:-1]

N, Q = map(int, input().split())
tree = [[] for _ in range(N+1)]
ans = [0 for _ in range(N+1)]

def dfs(v, p = -1):
    for u in tree[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)

def main():

    AB = [list(map(int,input().split())) for _ in range(N-1)]
    AB.sort()

    for a,b in AB:
        tree[a].append(b)
        tree[b].append(a)

    for _ in range(Q):
        p,x = map(int, input().split())
        ans[p] += x

    dfs(1)
    print(*ans[1:])

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**6)
N, Q = map(int, input().split())
tree = [[] for _ in range(N)]
ans = [0] * N

def dfs(v, p):
    for u in tree[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)

def main():

    for _ in range(N-1):
        a, b = map(int,input().split())
        a -= 1
        b -= 1
        tree[a].append(b)
        tree[b].append(a)

    for _ in range(Q):
        p,x = map(int, input().split())
        ans[p-1] += x
    # print(ans)

    dfs(0, -1)
    print(*ans)

if __name__ == "__main__":
    main()
A,B = map(input(split.()))
if A>=10 or B>=10: 
    print(-1)
else:
    print(A*B)

### FIXED CODE ###

A,B = map(int,input().split())
if A>=10 or B>=10: 
    print(-1)
else:
    print(A*B)
import sys
sys.setrecursionlimit(20000)

N, Q = map(int, input().split())
T = [[] for _ in range(N)]
ans = [0] * N

for _ in range(N-1):
  a, b = map(int, input().split())
  T[a-1].append(b)

#再帰は危険かも？
def dfs(s):
  ans[s-1] += x
  for i in T[s-1]:
    dfs(i)

for _ in range(Q):
  p, x = map(int, input().split())
  dfs(p)

print(*ans)

### FIXED CODE ###

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**6)

N, Q = map(int, input().split())
T = [[] for _ in range(N)]
ans = [0] * N

for _ in range(N-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  T[a].append(b)
  T[b].append(a)

cnt = [0] * N
for _ in range(Q):
  p, x = map(int, input().split())
  p -= 1
  cnt[p] += x

def dfs(x, d, s): # x:計算する頂点（上側）, d:計算済み(0)か否か(1), s:頂点xの値
  for y in T[x]: # 頂点xとつながる各頂点yの計算を行う
    if d[y] == 1: # 頂点yが計算未了の場合
      s += cnt[y] # 頂点xの値sに頂点yの値を足す
      ans[y] = s # 頂点yの値はsに確定
      d[y] = 0 # 頂点yの計算は終わったのでd[y]=0とする
      dfs(y, d, s) # 頂点yの下層についても再帰的に計算
      s -= cnt[y] # 頂点yの下層の計算が終わったので、sを頂点xの値に戻す

d = [1] * N
d[0] = 0

ans[0] = cnt[0]
s = cnt[0]

dfs(0, d, s)

print(*ans)
S = input()
answer = 0
for i in range(int(S)//2019 + 1):
    f = 2019 * i
    if f in S:
        answer += 1

print(answer)

### FIXED CODE ###

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

pops = 0
digi = 1
cnt = [0] * 2019
cnt[0] = 1

while S:
    s = S.pop()

    pops = (pops + s * digi) % 2019
    digi = (10 * digi) % 2019

    cnt[pops] += 1

ans = 0

for i in range(2019):
    ans += cnt[i] * (cnt[i] - 1) // 2

print(ans)
# -*- coding: utf-8 -*-
      
      
  ptint("aaa")
  
  

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Nov  3 09:19:07 2018

@author: sk
"""

     
      
b, c = map(int, input().split())
     
s=0.5*(b+c)
     
d = int(s)
    
if s-d > 0:
    v=int(d+1)
else :
    v=int(d)
print(v)
if args is None:
    i = [int(each) for each in input().split()]
else:
    i = [int(each) for each in args.split()]
print(min(i[1], i[2]), max(i[1] + i[2] - i[0], 0))

### FIXED CODE ###

i = [int(each) for each in input().split()]
print(min(i[1], i[2]), max(i[1] + i[2] - i[0], 0))
N = int(input())


if N % 2 == 0:
    if N == 2:
        print(1%2)

    else:
        print( int( ( N / 2 ) * (N-1) ) + )

elif N % 2 == 1:

    print( int( ( ( N / 2 ) * (N-1) )     ))


### FIXED CODE ###

N = int(input())
print( (N *(N-1)) // 2 )
N = int(input())
A = [int(i) for i in input().split(',')]

is_all_even = True
counter = 0
while True:
    for i in range(len(A)):
        if A[i] % 2 == 0:
            A[i] = int(A[i] / 2)
        else:
            is_all_even = False
    if is_all_even:
        counter += 1
    else:
        break
print(counter)


### FIXED CODE ###

i = input()
print(int(i[0] == '1') + int(i[1] == '1') + int(i[2] == '1'))
import bisect

N=int(input())
A=[int(input()) for i in range(N)]

c=0
B=[]
for a in A:
  p=bisect.bisect_left(b,a)
  if p==0:
    B.insert(0,a)
  else:
    B[p-1]=a

print(len(B))


### FIXED CODE ###

import bisect

N=int(input())
A=[-int(input()) for i in range(N)]

B=[]
c=0
for a in A:
  p=bisect.bisect_right(B,a)
  if p==c:
    B.append(a)
    c += 1
  else:
    B[p]=a

print(len(B))
s = input()

def kaibun1(w):
  w = str(w)
  t = len(w)
  n = 1
  while n < t//4:
    if w[n-1] == w[(t-1)//2 - (n-1)]:
      n += 1
    else:
      return False
      break

def kaibun2(w):
  w = str(w)
  t = len(w)
  m = 1
  while m < t//4:
    if w[t+3//2-1+(m-1)] == w[t-(m-1)]:
      m += 1
    else:
      return False
      break
if kaibun1(s)  is False or kaibun2(s) is False:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

s = input()
n = len(s)
s1 = s[0:(n-1)//2]
s2 = s1[::-1]
s3 = s[(n+3)//2-1:n]
s4 = s3[::-1]
if s1 == s2 == s3 == s4:
  print('Yes')
else:
  print('No')
h,a = map(int,input().split())
print(h//a + (1-int(h%a==0))


### FIXED CODE ###

h,a = map(int,input().split())
print(h//a+1-int(h%a==0))
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

v = a * a * b
s = x / a

import math
if x < v / 2:
    # print(math.degrees(math.atan(2 * s / b / b)))
    print(90 - math.degrees(math.atan(2 * s / b / b)))
else:
    print(90 - math.degrees(math.atan(a / (b - (2 * s / a - b)))))



### FIXED CODE ###

import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b, x = map(int, readline().split())

v = a * a * b
s = x / a

if x == v:
    print(0)
    exit()

if x <= v / 2:
    # print(math.degrees(math.atan(2 * s / b / b)))
    print(90 - math.degrees(math.atan(2 * x / a / b / b)))
else:
    print(90 - math.degrees(math.atan(a / (b - (2 * s / a - b)))))
s = input()
t = input()
s1 = [str(a) for a in s]
t1 = [str(a) for a in t]
s1.sort()
t1.sort()
import copy
t2 = copy.copy(t1)
for i in range(len(t1)):
  t1[i] = t2[len(t1)-i-1]
if len(s) < len(t):
  k = 0
  for i in range(len(s)):
    if s1[i] == t1[i]:
      k = k + 1
  if k = len(s):
    print('Yes')
  else:
    print('No')
else:
  n = 0
  l = 0
  i = 0
  while n==0 and i < len(t):
    if s1[i] == t1[i]:
      l = l + 1
      i = i + 1
    elif s1[i] < t1[i]:
      n = n + 1
      print('Yes')
    elif s1[i] > t1[i]:
      n = n + 1
      print('No')
  if l = len(t):
    print('No')

### FIXED CODE ###

s = input()
t = input()
s1 = [str(a) for a in s]
t1 = [str(a) for a in t]
s1.sort()
t1.sort()
import copy
t2 = copy.copy(t1)
for i in range(len(t1)):
  t1[i] = t2[len(t1)-i-1]

n = 0
l = 0
i = 0
while n==0 and i <= min(len(t),len(s))-1:
  if s1[i] == t1[i]:
    l = l + 1
    i = i + 1
  elif s1[i] < t1[i]:
    n = n + 1
    print('Yes')
  elif s1[i] > t1[i]:
    n = n + 1
    print('No')
if l == len(t) and len(t) <= len(s):
  print('No')
elif l == len(s) and len(s) < len(t):
  print('Yes')
N,M = map(int,input().split())
A = list(map(int,input().split()))
BC = [list(map(int,input().split())) for _ in range(M)]
BC.sort(key=lambda x: -x[1])
A.sort()
cur = 0
for b,c in BC:
    while b > 0:
        b -= 1
        if A[cur] < c:
            A[cur] = c
            cur += 1
        else:
            break
    else:
        continue
    break
print(sum(A))


### FIXED CODE ###

"""
カードの中から値がC未満のものをB枚までCに変更していく。これを高速に行えばよい。
heapqにぶち込めばよさそう?いや、それだとO(NMlogN)かかる
BIT使えばよいのか？いや、それもダメO(10**9log10**9)かかる
1クエリに対して、logN以下で処理しなくてはいけない。
Aを昇順に並べ替えておいて、常に昇順が保たれるようにしておけば二分探索できる。
あーでも途中で値を更新する作業があるから結局O(MN)かかるな
そもそも値を配列で管理してはいけないんだな。
どの値がいくつある。という管理の仕方をしないといけない。
ってなると、座標圧縮してBITだな。これはムズイわ。
"""
class BIT:
    def __init__(self,n):
        self.tree = [0]*(n+1)
        self.size = n

    def sum(self,i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i&-i
    
    def add(self,i,x):
        while i <= self.size:
            self.tree[i] += x
            i += i&-i

import heapq
N,M = map(int,input().split())
A = list(map(int,input().split()))
heapq.heapify(A)
BC = [list(map(int,input().split())) for _ in range(M)]
BC.sort(key=lambda x: -x[1])

for b,c in BC:
    while b > 0:
        b -= 1
        a = heapq.heappop(A)
        if a < c:
            heapq.heappush(A,c)
        else:
            heapq.heappush(A,a)
            break
    else:
        continue
    break
print(sum(A))
a = input()
a=int(a)
ans=0
for i in ramge(1,a+1):
  ans+=i
print(ans)

### FIXED CODE ###

a = input()
a=int(a)
ans=0
for i in range(1,a+1):
  ans+=i
print(ans)
from sys import stdin

x, y, a, b, c = [int(x) for x in stdin.readline().rstrip().split()]

p = [int(x) for x in stdin.readline().rstrip().split()]
q = [int(x) for x in stdin.readline().rstrip().split()]
r = [int(x) for x in stdin.readline().rstrip().split()]


ps = sorted(p, reverse=True)
qs = sorted(q, reverse=True)

pss = ps[0:x]
pss.extend(qs[0:y])

he = 0

for i in range(x+y):
    for j in range(len(r)):
        if pss[i] < r[j]:
            pss[i] = r.pop(j)
            break
    he += pss[i]

print(he)

### FIXED CODE ###

# -*- coding: utf-8 -*-

s = input()

if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")