Harryxun/stf_run huggingface dataset:
S = input()
T = input()

ans = 'No'
for _ in range(len(S)):
    if S == T:
        ans = 'Yes'
        break
    S = S[-1] + S[:-1]

print(ans)


### FIXED CODE ###

from itertools import permutations
a_list = list(map(int, input().split()))

ans = 1000
for p in permutations(a_list):
    cost = abs(p[1] - p[0]) + abs(p[2] - p[1])
    ans = min(cost, ans)

print(ans)
while 1:
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))

    dp = [a[0]]
    for i in range(1,len(a)):
        dp.append(max(dp[i-1] + a[i], a[i]))

    print(max(dp))

### FIXED CODE ###

while 1:
    n = int(input())
    if n == 0:
        break
    a = []
    for _ in range(n):
        a.append(int(input()))

    dp = []
    dp.append(a[0])
    for i in range(1,len(a)):
        dp.append(max(dp[i-1] + a[i], a[i]))

    print(max(dp))
def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]
ans = None

d, t, s = m_in()
ans = 'Yes' if d <= t*s else 'No'

print(ans)


### FIXED CODE ###

def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]
ans = None

d, t, s = m_in(int)
ans = 'Yes' if d <= t*s else 'No'

print(ans)
cards = []
for s in ['S', 'H', 'C', 'D']:
    for n in range(1,14,1):
        cards += ["%s %s" % (s, n)]

input_cards = []
input_cards = raw_input()
while True:
    input_card = raw_input()
    cards.remove(input_card)

    for card in cards:
        print(card)

### FIXED CODE ###

cards = []
cards = ["%s %s" % (s, n) for s in ['S', 'H', 'C', 'D'] for n in range(1,14,1)]

input_cards = []
input_cards_num = int(raw_input())
for i in range(1, input_cards_num + 1, 1) :
    input_card = raw_input()
    cards.remove(input_card)

for card in cards:
    print(card)
a, b, c, d = map(int, input().split())

AB = abs(a - b)
BC = abs(b - c)
AC = abs(a - c)

if AC <= d or ( AB <= d and BC <= d:):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

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

AB = abs(a - b)
BC = abs(b - c)
AC = abs(a - c)

if AC <= d:
    print("Yes")
elif AB <= d and BC <= d:
    print("Yes")
else:
    print("No")
N,K = map(int, input().split())
P = list(map(int,input().split()))

def calc_expected_val(val):
    return float((1+val)/2)

def main():
    expected_val = 0
    expected_val_list = []
    sum_val = 0
    sum_val_list = []
    sum_K = 0
    sum_K_list = []
    max_expected_val = 0
    for i in range(N):
        expected_val = calc_expected_val(P[i])
        expected_val_list.append(expected_val)
        sum_val += expected_val
        sum_val_list.append(sum_val)

    for j in range(K, N):
        sum_K = sum_val_list[j] - sum_val_list[j-K]
        sum_K_list.append(sum_K)

    max_expected_val = max(sum_K_list)
    print(max_expected_val)

if __name__ == "__main__":
    main()
    

### FIXED CODE ###

N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = 0
cum = [0]
     
for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
        
for i in  range(len(p)):
    cum.append(p[i] + cum[i])
        
for i in range(K, N+1):
    ans  = max(ans, cum[i] - cum[i-K])
     
print(ans)
h, w, k=map(int, input(). split())
table=[[0] * w for i in range(h)]
trial=h+w
original=0

for i in range(h):
    s=input()
    for j in range(w):
        table[i][j]=s[j]
        if table[i][j]=="#":
            original+=1


copy=[[0] * w for i in range(h)]

ans=0
cnt=0
for i in range(2**trial):
    for j in range(h):
        for k in range(w):
            copy[j][k]=table[j][k]
    
    cnt=0
    for l in range(trial):
        if ((i>>l)&1)==1:
            if l<=h:
                for m in range(w):
                    if copy[l][m]=="#":
                        copy[l][m]="."
                        cnt+=1
            
            else:
                l-=h
                for m in range(h):
                    if copy[m][l]=="#":
                        copy[m][l]="."
                        cnt+=1
    
    if original-cnt==k:
        ans+=1

print(ans)

### FIXED CODE ###

h, w, k = map(int, input().split())
ans = 0
c = [input() for i in range(h)]
for i in range(1<<h):
    for j in range(1<<w):
        cnt = 0
        for l in range(h):
            for m in range(w):
                if c[l][m] == '#' and (i >> l) & 1 and (j >> m) & 1:
                    cnt += 1
        if cnt == k:
            ans += 1
print(ans)
N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(Q)]
ans = set()

def point(x):
    temp = 0
    for i in range(Q):
        a, b, c, d = abcd[i]
        if x[b-1] - x[a-1] == c:
            temp += d
    return temp

def maker(x):
    dig = len(x)
    if  dig == N:
        ans.add(point(x))
    else:
        for i in range(x[-1], M+1):
            maker(x + [i])

for i in range(1, M):
    maker([i])
print(max(ans))

### FIXED CODE ###

N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(Q)]
ans = set()

def point(x):
    temp = 0
    for i in range(Q):
        a, b, c, d = abcd[i]
        if x[b-1] - x[a-1] == c:
            temp += d
    return temp

def maker(x):
    dig = len(x)
    if  dig == N:
        ans.add(point(x))
    else:
        for i in range(x[-1], M+1):
            maker(x + [i])

for i in range(1, M+1):
    maker([i])
print(max(ans))
n,p = map(int, input().split())
a = int(p**(1/n))+1
for i in range(a,0,-1):
  if p%(i**n)==0:
    print(i)
    exit()

### FIXED CODE ###

n,p = map(int, input().split())
a = round(p**(1/n))
for i in range(a,-1,-1):
  if p%(i**n)==0:
    print(i)
    exit()
X = int(input())
mod = X % 100
q = int(X //100)
sum = 0
ans = 0
if q => 100:
    ans = 1
else:
    for i in range (0,q+1):
        for j in range (0,q+1-i):
            for k in range (0,q+1-i-j):
                for l in range (0,q+1-i-k-j):
                    for m in range (0,q+1-i-j-k-l):
                        sum = i+(2*j)+(3*k)+(4*l)+(5*m)
                        if sum == mod:
                            ans = 1
print(ans)


### FIXED CODE ###

X = int(input())
mod = X % 100
q = int(X //100)
sum = 0
ans = 0
if q >= 20:
    ans = 1
else:
    for i in range (0,q+1):
        for j in range (0,q+1-i):
            for k in range (0,q+1-i-j):
                for l in range (0,q+1-i-k-j):
                    for m in range (0,q+1-i-j-k-l):
                        sum = i+(2*j)+(3*k)+(4*l)+(5*m)
                        if sum == mod:
                            ans = 1
print(ans)
A,B,C =map(int,input().split())
con = 0

if A == B and B == C:
  print(-1)
  exit()
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    break
  con += 1
  D = A / 2
  E = B / 2
  F = C / 2
  A = E + F
  B = D + F
  C = D + E
  
print(con)

### FIXED CODE ###

A,B,C =map(int,input().split())
con = 0
if A % 2 == 1 or B % 2 == 1 or C % 1 == 1:
  print(0)
  exit()
if A == B and B == C:
  print(-1)
  exit()
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
  con += 1
  D = A / 2
  E = B / 2
  F = C / 2
  A = E + F
  B = D + F
  C = D + E
print(con)
a,b=map(int,input().split())
s=0
for i in range(a,b+1):
    x=list(str(i))
    y=[]
    for k in range(len(x)):
        y.append(x[len(x)-i-1])
    z=""
    for j in y:
        z+=j
    if i==int(z):
        s+=1
print(s)
      
        

### FIXED CODE ###

a,b=map(int,input().split())
s=0
for i in range(a,b+1):
    x=list(str(i))
    y=[]
    for k in range(len(x)):
        y.append(x[-1-k])
    z=""
    for j in y:
        z+=j
    if i==int(z):
        s+=1
print(s)
class Node():
    def __init__(self, p, l, r):
        self.p = p
        self.l = l
        self.r = r


def rec(u, p):
    D[u] = p
    if T[u].r != -1:
        rec(T[u].r, p)
    if T[u].l != -1:
        rec(T[u].l, p + 1)


N = int(input())
T = [Node(-1, -1, -1) for _ in range(N)]
D = [-1] * N
for i in range(N):
    i, k, *cs = map(int, input().split())
    for j, c in enumerate(cs):
        if j == 0:
            T[i].l = c
        else:
            T[l].r = c
        l = c
        T[c].p = i
for i, t in enumerate(T):
    if t.p == -1:
        r = i
rec(r, 0)
for i, t in enumerate(T):
    cs = []
    c = t.l
    while c != -1:
        cs.append(c)
        c = T[c].r
    if t.p == -1:
        print('node {}: parent = {}, depth = {}, root, {}'
              .format(i, t.p, D[i], cs))
    elif t.l == -1:
        print('node {}: parent = {}, depth = {}, leaf, {}'
              .format(i, t.p, D[i], cs))
    else:
        print('node {}: parent = {}, depth = {}, internal node, {}'
              .format(i, t.p, D[i], cs))



### FIXED CODE ###

import sys

sys.setrecursionlimit(1000000)

class Node():
    def __init__(self, p, l, r):
        self.p = p
        self.l = l
        self.r = r


def rec(u, p):
    D[u] = p
    if T[u].r != -1:
        rec(T[u].r, p)
    if T[u].l != -1:
        rec(T[u].l, p + 1)


N = int(input())
T = [Node(-1, -1, -1) for _ in range(N)]
D = [-1] * N
for i in range(N):
    i, k, *cs = map(int, input().split())
    for j, c in enumerate(cs):
        if j == 0:
            T[i].l = c
        else:
            T[l].r = c
        l = c
        T[c].p = i
for i, t in enumerate(T):
    if t.p == -1:
        r = i
rec(r, 0)
for i, t in enumerate(T):
    cs = []
    c = t.l
    while c != -1:
        cs.append(c)
        c = T[c].r
    if t.p == -1:
        print('node {}: parent = {}, depth = {}, root, {}'
              .format(i, t.p, D[i], cs))
    elif t.l == -1:
        print('node {}: parent = {}, depth = {}, leaf, {}'
              .format(i, t.p, D[i], cs))
    else:
        print('node {}: parent = {}, depth = {}, internal node, {}'
              .format(i, t.p, D[i], cs))
N,M,X,Y=map(int,input().split())
x_list =list(map(int,input().split()))
y_list=list(map(int,input().split()))

for i in range(1,100):

     if(max(x_list)<i and i<=min(y_list)):
        print('No War')
        exit(0)
print('War')
exit(0)

### FIXED CODE ###

lists=input().split()

for i in range(len(lists)):
    lists[i]=int(lists[i])

lists=sorted(lists,reverse=True)
print(lists[0]*10+lists[1]+lists[2])
h,a = map(int,input())
print(h//a + (1-(h%a==0))

### FIXED CODE ###

h,a = map(int,input().split())
print(h//a+1-int(h%a==0))
import sys
import math
a, b, x = map(int, sys.stdin.readline().strip().split())

s = x / a
if s >= a * b / 2:
    ans = math.atan(1 / (2 / a * (b - s / a)))
else:
    ans = math.atan(2 * s / (b ** 2))
print(90 - math.degrees(ans))


### FIXED CODE ###

# D
import sys
import math


# def main():
#     a, b, x = map(int, sys.stdin.readline().strip().split())
#
#     s = x / a
#     if s > a * b / 2:
#         ans = math.atan(a ** 2 / (2 * (a * b - s)))
#     else:
#         ans = math.atan(2 * s / (b ** 2))
#
#     print(90 - math.degrees(ans))

def main():
    a, b, x = map(int, sys.stdin.readline().strip().split())

    s = x / a
    if s > a * b / 2:
        ans = math.degrees(math.atan(2 * b / a - 2 * s / (a ** 2)))
        print(ans)
    else:
        ans = 90 - math.degrees(math.atan(2 * s / (b ** 2)))
        print(ans)


if __name__ == '__main__':
    main()
x = input()
print(2*x*3.14)

### FIXED CODE ###

x = int(input())
print(2*x*3.14)
# /usr/bin/python
# -*- coding: utf-8 -*-
import math



An = [0 for _ in range(100001)]
for _ in range(int(input())):
  i = int(input())
  An[i] = (An[i]+1)%2

print(sum(An))

### FIXED CODE ###

# /usr/bin/python
# -*- coding: utf-8 -*-
import math
from collections import defaultdict


An = defaultdict()
for _ in range(int(input())):
  i = int(input())
  if i not in An:
    An[i] = 1
  else:
    An[i] += 1

ans = 0
for i in An:
  ans += An[i]%2
print(ans)
a,b,x=map(int,input().split())
def an():
    if x>a*1e+9+b*10:
        print(int(1e+9))
        return
    i=int(1e+9)
    j=i
    cou=0
    while True:
        cou+=1
        if(cou>10000):break#整数除算で限界が来た時用
        d=len(str(i))
        if a*i+b*d>x:
            j=i
            i//=2
        elif a*i+b*d<x:
            i=(i+j)//2
        else:
            return
    for k in range(min(i,j),max(i,j)+1):
        d=len(str(k))
        if a*k+b*d==x:
            print(k)
            return
        if a*k+b*d>x:
            print(k-1)
            return
an()

### FIXED CODE ###

s = input()
if s=='SUN':
  print(7)
elif s=='MON':
  print(6)
elif s=='TUE':
  print(5)
elif s=='WED':
  print(4)
elif s=='THU':
  print(3)
elif s=='FRI':
  print(2)
elif s=='SAT':
  print(1)
import sys
input=sys.stdin.readline
S=input()
l=len(S)
w_idx=0
cnt=0
for i in range(n):
    if S[l]=='W':
        cnt+=i-w_idx
        w_idx+=1
print(cnt)

### FIXED CODE ###

S=input()
l=len(S)
w_idx=0
cnt=0
for i in range(l):
    if S[i]=='W':
        cnt+=i-w_idx
        w_idx+=1
print(cnt)
S=str(input())
T=str(input())
ls=len(S)
lt=len(T)

ans=''
for i in range(ls-lt,-1,-1):
  flag=0
  for j in range(lt):
    if not (S[i+j] == T[j] or S[i+j] == '?'):
      flag=1
      break
  if flag==0:
    loc=i
    break

if loc>-1:
  print('UNRESTORABLE')
else:
  i=0
  while i<ls:
    if i==loc:
      ans += T
      i += lt
    elif S[i] == '?':
      ans += 'a'
      i += 1
    else:
      ans += S[i]
      i += 1
  print(ans)


### FIXED CODE ###

S=str(input())
T=str(input())
ls=len(S)
lt=len(T)

ans=''
loc=None
for i in range(ls-lt,-1,-1):
  flag=0
  for j in range(lt):
    if not (S[i+j] == T[j] or S[i+j] == '?'):
      flag=1
      break
  if flag==0:
    loc=i
    break

if loc == None:
  print('UNRESTORABLE')
else:
  i=0
  while i<ls:
    if i==loc:
      ans += T
      i += lt
    elif S[i] == '?':
      ans += 'a'
      i += 1
    else:
      ans += S[i]
      i += 1
  print(ans)
O = input()
E = input()

s=''
try:
  for i in range(len(O)):
    s += O[i]
    s+= E[i]
finally:
  print(s)
  

### FIXED CODE ###

O = input()
E = input()

s=''
for i in range(len(O)):
  s += O[i]
  if i < len(E):
    s+= E[i]
print(s)
ab = list(map(int,input().split()))
a,b = ab[0],ab[1]
d = []
for i in range(100):
    if (i*(i+1))/2 >a and ((i+1)*(i+2))/2 > b:
        d.append(i)
x,y = (d[0]*(d[0]+1))/2, ((d[1]+1)*(d[1]+2))/2
print(int(x - a))

### FIXED CODE ###

ab = input().split()
a,b = int(ab[0]),int(ab[1])
d = []
z = b - a 
if ((z-1)*z)/2 >a and ((z+1)*(z+2))/2 > b:
    x,y = ((z-1)*z)/2, ((z+1)*(z+2))
print(int(x - a))
n, m = map(int, input().split())
sc = []
for i in range(m):
    sc.append(tuple(map(int, input().split())))


for i in range(10**(n-1), 10**n):
    s = str(i)
    flag = True
    if len(s) == n and all([s[sc[j][0]-1] == str(sc[j][1]) for j in range(m))]:
        print(s)
        exit(0)


print('-1')


#
# for i in range(1, n+1):
#    if list(zip(*sc))[0].count(i) > 1:
#        print('-1')
#        exit(0)
#
#
# if min(list(zip(*sc))[0]) != 1:
#    print('-1')
#    exit(0)
#
# for i in sc:
#    if i[0] == 1 and i[1] == 0 and n > 1:
#        print('-1')
#        exit(0)
#
#ans = [0, 0, 0]
# for i in sc:
#    ind, val = i[0]-1, i[1]
#    if ans[ind] != 0:
#        ans[ind] = min(ans[ind], val)
#    else:
#        ans[ind] = val
#
#print(''.join(list(map(str, ans))))


### FIXED CODE ###

n, m = map(int, input().split())
sc = []
for i in range(m):
    sc.append(list(map(int, input().split())))


for i in range(10**n):
    s = str(i)
    if len(s) == n and all([s[sc[j][0]-1] == str(sc[j][1]) for j in range(m)]):
        print(s)
        exit(0)


print('-1')


#
# for i in range(1, n+1):
#    if list(zip(*sc))[0].count(i) > 1:
#        print('-1')
#        exit(0)
#
#
# if min(list(zip(*sc))[0]) != 1:
#    print('-1')
#    exit(0)
#
# for i in sc:
#    if i[0] == 1 and i[1] == 0 and n > 1:
#        print('-1')
#        exit(0)
#
#ans = [0, 0, 0]
# for i in sc:
#    ind, val = i[0]-1, i[1]
#    if ans[ind] != 0:
#        ans[ind] = min(ans[ind], val)
#    else:
#        ans[ind] = val
#
#print(''.join(list(map(str, ans))))
from functools import reduce
n=int(input())
data=[]
for i in range(n):
    data.append(int(input()))
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
print(reduce(lcm,data))

### FIXED CODE ###

def func(a,b):
    return a if b==0 else func(b,a%b)
n = int(input())
num = int(input())
for i in range(n-1):
    d = int(input())
    num = num*d//func(num,d)
print(num)
N, K = map(int, input().split())

ans = 0
extra = [0] * N
for i in range(1, N+1): extra[i%K] += 1 #extra[X] = Kで割ってXあまる数がN以下に何個あるか

for a in range(K):
    b = (K-a) % K
    c = (K-a) % K

    if (b + c) % K == 0:
        ans += extra[a] * extra[b] * extra[c]
print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
ans = 0
extra = [0]*K
for i in range(1, N+1): extra[i%K] += 1 #extra[X] = Kで割ってXあまる数がN以下に何個あるか

for a in range(K):
    b = (K-a) % K
    c = (K-a) % K

    if (b + c) % K == 0:
        ans += extra[a] * extra[b] * extra[c]
print(ans)
n = int(input())
a = list(map(int, input().split()))
s = [0 for _ in range(n)]

score = 0
for i in range(n):
    l = s.index(0)
    r = s[::-1].index(0)
    #right
    score_r, score_l = score, score
    sr, sl = s.copy(), s.copy()
    if r >= i:
        sr[r] = a[i]
        score_r += a[i] * (r - i)
        while r < n-1 and sr[r] > sr[r+1]:
            score_r += sr[r] - sr[r+1]
            sr[r], sr[r+1] = sr[r+1], sr[r]
            r += 1

    if l <= i:
        sl[l] = a[i]
        score_l += a[i] * (i - l)
        while l > 0 and sl[l-1] < sl[l]:
            score_l += sl[l] - sl[l-1]
            sl[l-1], sl[l] = sl[l], sl[l-1]
            l += 1

    if score_r >= score_l:
        score = score_r
        s = sr

    else:
        score = score_l
        s = sl


print(score)
#print(s)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a = [(a[i], i) for i in range(n)]
a.sort(key=lambda x: -x[0])
dp = [[0 for _ in range(n+1)] for _ in range(n+1)]

for x in range(n+1):
    for y in range(n+1):
        if x + y > n:
            break
        active, idx = a[x+y-1]
        if x > 0:
            dp[x][y] = max(dp[x][y],
                           dp[x-1][y] + active * abs(idx - (x-1)))

        if y > 0:
            dp[x][y] = max(dp[x][y],
                           dp[x][y-1] + active * abs(idx - (n-y)))

ans = 0
for x in range(n+1):
    ans = max(ans, dp[x][n-x])

print(ans)
N,M = map(int,input().split())
H=list(map(int,input().split()))
ABmap=[[] for i in range(N)]
count=0
for i in range(M):
    A,B=map(lambda x:x-1,map(int,input().split()))
    ABmap[A].append(H[B])
    ABmap[B].append(H[A])
        
for i in range(N):
    #print(ABmap[i])
    #print(ABmap.count(H[i]))
    if max(ABmap[i])<H[i]:
        count+=1
print(count)
        
    

### FIXED CODE ###

N,M = map(int,input().split())
H=list(map(int,input().split()))
ABmap=[[] for i in range(N)]
count=0
for i in range(M):
    A,B=map(lambda x:x-1,map(int,input().split()))
    ABmap[A].append(H[B])
    ABmap[B].append(H[A])
        
for i in range(N):
    if len(ABmap[i])==0:
        count+=1
    elif max(ABmap[i])<H[i]:
        count+=1
   # print(ABmap[i])
print(count)
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect
import itertools
import heapq


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(input):
    [A, B] = string_to_int(input)
    return A*B


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


### FIXED CODE ###

import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect
import itertools
import heapq


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(input):
    nums = string_to_int(input)

    def euclid(large, small):
        if small == 0:
            return large
        l = large % small
        return euclid(small, l)

    nums.sort(reverse=True)
    eee = euclid(nums[0], nums[1])
    return int((nums[0] * nums[1]) / eee)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(input())
    print(ret)
a,b,c = map(int, input().split())
import.math

A = a+b+2*math.sqrt(a*b)

if A < c:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

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

if x <= 0:
  print("No")
elif 4*a*b >= x**2:
  print("No")
else:
  print("Yes")
import fractions
def lcm(a, b):
    return (a*b)//fracitons.gcd(a,b)

N = input().split()
N = [int(i) for i in N]
print(lcm(N[0],N[1]))



### FIXED CODE ###

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

N = input().split()
N = [int(i) for i in N]
print(lcm(N[0],N[1]))
def f(i):
    if i > len(S)-2:
        return 10**6
    ans = S[:i].count('W')+S[i+1:].count('E')
    return min(ans,f(i+1))

n=input()
S = input()+'_'

print(f(0))

### FIXED CODE ###

input()
S = input()

def f():
    ans,total = 0,0
    for s in S:
        if s == 'W':
            total += 1
        elif total:
            total -= 1
            ans += 1
        else:
            pass
    return ans

print(f())
def not_found_minchar(S):
    sorted_S = sorted(set(S))
    idx = 0
    for o in range(ord('a'), ord('z') + 1):
        if o < ord(sorted_S[idx]):
            return chr(o)
        idx += 1
    return "None"

S = raw_input()
print not_found_minchar(S)


### FIXED CODE ###

def not_found_minchar(S):
    for o in range(ord('a'), ord('z') + 1):
        if chr(o) not in S:
            return chr(o)
    return "None"

S = raw_input()
print not_found_minchar(S)
#AGC030 B - Powers of two
import collections
import math
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
cnter=collections.Counter(A)
ans=0
for a in A:
    inv=2**(int(math.log2(a))+1)
    if cnter[a]==0:
        continue
    if cnter[a]>=2 and a==inv//2:a
        cnter[a]=cnter[a]-2
        ans=ans+1
        continue
    if inv-a in cnter:
        cnter[inv-a]=cnter[inv-a]-1
        ans=ans+1
print(ans)

### FIXED CODE ###

#AGC030 B - Powers of two
import collections
import math
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
cnter=collections.Counter(A)
ans=0
for a in A:
    inv=2**(int(math.log2(a))+1)
    if cnter[a]==0:
        continue
    if inv==2*a and cnter[inv-a]<=1:
      	continue
    if cnter[inv-a]>0:
        cnter[inv-a]=cnter[inv-a]-1
        cnter[a]=cnter[a]-1
        ans=ans+1
print(ans)
N = input()

a = int(N/100)
b = int( (N-a*100)/10 )
c = int(N-a*100-b*10)

if a == 7 or b == 7 or c == 7
    print("Yes")
  else print("No")
  

### FIXED CODE ###

num = input();

if num[0] == "7" or num[1] == "7" or num[2] == "7" :
  print("Yes");
else:
  print("No");
n = int(input())
if n == 2:
    print(1)
elif n == 3:
    print(2)
else:
    #print(make_divisors(n-1))
    print(len(make_divisors(n-1))+1)

### FIXED CODE ###

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

N = int(input())
divsN = make_divisors(N)
divsN2 = make_divisors(N-1)
divsN.pop(0)

ans = len(divsN2)-1

for div in divsN:
    n = N+1-1
    while True:
        if n%div != 0 or n==1:
            break
        n //= div
    if n%div == 1:
        ans += 1

print(ans)