Harryxun/stf_run huggingface dataset:
n = int(input())
x = list(input())
for i in range(n):
  if x[i]==x[i+1]:
    x.pop(i)
print(len(x))


### FIXED CODE ###

n = int(input())
x = list(input())
count = n
for i in range(n-1):
  if x[i]==x[i+1]:
    count-=1
print(count)
n, m = list(map(int, input().split()))
hs = list(map(int, input().split()))
ans = [1]*n
for i in range(m):
    road = list(map(int, input().split()))
    if hs[road[0]-1] <= hs[road[1]-1]:
        ans[road[0]-1] = 0
    if hs[road[0]-1] >= hs[road[1]-1]:
        ans[road[1]-1] = 0
print(ans.count(0))


### FIXED CODE ###

s = input()
if s == "ABC":
    print("ARC")
else:
    print("ABC")
n = int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
xyh = sorted(xyh, key=lambda x:(x[2]))

for cx in range(101):
    for cy in range(101):
        flg = True
        x, y, h = xyh[0][0], xyh[0][1], xyh[0][2]
        ch = abs(cx-x) + abs(cy-y) + h
        # print(cx, cy, ch)
        for i in range(1,n):
            x, y, h = xyh[i][0], xyh[i][1], xyh[i][2]
            tmph = max(ch - abs(cx-x) - abs(cy-y), 0)
            if h != tmph:
                flg = False
                break
        if flg:
            ans = cx, cy, ch
            # break
    if flg:
        break
print(*ans)

### FIXED CODE ###

n = int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
xyh = sorted(xyh, key=lambda x:(x[2]), reverse=True)

ans = -1, -1, -1
for cx in range(101):
    for cy in range(101):
        flg = True
        x, y, h = xyh[0][0], xyh[0][1], xyh[0][2]
        ch = abs(cx-x) + abs(cy-y) + h
        for i in range(1,n):
            x, y, h = xyh[i][0], xyh[i][1], xyh[i][2]
            tmph = max(ch - abs(cx-x) - abs(cy-y), 0)
            if h != tmph:
                flg = False
                break
        if flg:
            ans = cx, cy, ch
print(*ans)
N, W = [int(i) for i in input().split()]
weight, value = [0]*110, [0]*110

for i in range(N):
    w, v = [int(i) for i in input().split()]
    weight[i] = w; value[i] = v;

dp = [[0 for _ in range(110)] for _ in range(100100)]

for i in range(N):
    for j in range(W+1):
        if (j-weight[i] >= 0):
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-weight[i]] + value[i])
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])

print(dp[N][W])

### FIXED CODE ###

N, W = [int(i) for i in input().split()]
weight, value = [], []

for i in range(N):
    w, v = [int(i) for i in input().split()]
    weight.append(w); value.append(v);
weight.append(0)
value.append(0)

dp = [[0 for _ in range(W+1)] for _ in range(N+1)]

for i in range(N):
    for j in range(W+1):
        if (j-weight[i] >= 0):
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-weight[i]] + value[i])
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])

print(dp[N][W])
N = int(input())
S = []
for i in range(N):
    s = str(input())
    s = ''.join(sorted(a))
    S.append(s)

count = 0
for i in range(N):
    Si = S[i]
    for k in range(N):
        if i==k:
            None
        else:
            Sk = S[k]
            if Sk == Si:
                count += 1

print(count / 2)


### FIXED CODE ###

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

X = []
X.append(A+B)
X.append(A-B)
X.append(A*B)

X.sort()

print(X[2])
s = input())
t = input())
n = 1
m = len(t)
if s == t[0:m-1]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s = list(input())
t = list(input())
n = int(len(t))
m = int(len(s))
if s == t[0:n-1] and n-1 == m:
  print('Yes')
else:
  print('No')
def dfs(u, prev, visited, lowest, parent, prenum):
    # ????????? u ????¨????????????´????????????
    visited |= {u}
    prenum[u] = len(visited)
    lowest[u] = len(visited)

    for v in g[u]:
        if v not in  visited:
            # ????????? u ??????????????? v ????¨????????????´????????????
            parent[v] = u
            dfs(v, u, visited, lowest, parent, prenum)
            # ????????? v ?????¢?´¢?????????????????´????????????
            lowest[u] = min(lowest[u], lowest[v])
        elif v != prev:
            # ??¨?????? u --> v ??? Back-edge ?????´????????????
            lowest[u] = min(lowest[u], prenum[v])
    # ????????? u ?????¢?´¢?????????????????´????????????

from sys import stdin
readline = stdin.readline


v, e = map(int, readline().split())
from collections import defaultdict
g = defaultdict(list)

for _ in range(e):
    s, t = map(int, readline().split())
    g[s].append(t)
    g[t].append(s)
    
visited = set()
lowest = [None] * v
parent = [None] * v
prenum = [None] * v
root = 0
# lowest ????¨????
dfs(root, -1, visited, lowest, parent, prenum)

child = defaultdict(list)
for i in range(v):
    if parent[i] is not None:
        child[parent[i]].append(i)
if 2 <= len(child[root]):
    print(root)
for i in range(1, v):
    if child[i] and any(prenum[i] <= lowest[j] for j in child[i]):
        print(i)

### FIXED CODE ###

from sys import stdin
readline = stdin.readline


def main():
    v, e = map(int, readline().split())
    from collections import defaultdict
    g = defaultdict(list)

    for _ in range(e):
        s, t = map(int, readline().split())
        g[s].append(t)
        g[t].append(s)

    visited = set()
    lowest = [None] * v
    parent = [None] * v
    prenum = [None] * v
    child = defaultdict(list)
    root = 0

    # dfs??§tree?????????
    stack = [(root, None)]
    while stack:
        u, prev = stack.pop()
        if u not in visited:
            parent[u] = prev
            if prev is not None:
                child[prev].append(u)
            visited |= {u}
            prenum[u] = lowest[u] = len(visited)

        stack.extend([(v, u) for v in g[u] if v not in visited])

    # lowest????¨????
    from collections import Counter
    leaf = [i for i in range(v) if not child[i]]
    unfinished = Counter()
    for li in leaf:
        while li is not None:
            candidate = [prenum[li]] + [prenum[i] for i in g[li] if i != parent[li]] + [lowest[i] for i in child[li]]
            lowest[li] = min(candidate)
            li = parent[li]
            if li is not None and 1 < len(child[li]):
                unfinished[li] += 1
                if unfinished[li] < len(child[li]):
                    break

    # ??£???????????????
    if 2 <= len(child[root]):
        print(root)
    for i in range(1, v):
        if child[i] and any(prenum[i] <= lowest[j] for j in child[i]):
            print(i)
main()
S = list(input().split())
for i in range(4):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Good")


### FIXED CODE ###

S = list(map(int, input().rstrip()))
for i in range(3):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Good")
n,m = map(int, input().split())
if n == m
   print("Yes")
else:
   print("No")


### FIXED CODE ###

n,m=map(int,input().split())
if n==m:
   print("Yes")
else:
   print("No")
import bisect
from collections import defaultdict

q = int(input())


n = 10**5 + 1
primes = set(range(2, n+1))

for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))

primes = list(primes)


def is_prime(i):
    p = bisect.bisect_left(primes, i)
    if primes[p] == i:
        return True
    else:
        return False


memo = defaultdict(bool)


ans = []
for _ in range(q):
    tmp = 0
    l, r = map(int, input().split())
    for i in range(l, r + 1, 2):
        if i in memo:
            tmp += memo[i]
        else:
            memo[i] = is_prime(i) and is_prime((i + 1) // 2)
            tmp += memo[i]
    ans.append(tmp)

print(*ans, sep="\n")

### FIXED CODE ###

import numpy as np

q = int(input())

# 素数列挙
n = 10**5 + 1
primes = set(range(3, n+1, 2))
for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)

arr = np.array(list(primes))
arr = np.bincount(arr)

# 素数かつ2017に似た数を列挙
like_2017 = np.zeros(n, bool)
for i in np.where(arr == 1)[0]:
    if (i + 1) // 2 in primes:
        like_2017[i] = True

like_2017 = like_2017.cumsum()


def cnt_primes(l, r):
    return like_2017[r] - like_2017[l - 1]


ans = []
for _ in range(q):
    tmp = 0
    l, r = map(int, input().split())
    tmp += cnt_primes(l, r)
    ans.append(tmp)

print(*ans, sep="\n")
a,b = map(int,input.split())

if a > 9 or b > 9:
  print(-1)
else:
  out = a * b
  print('{0}'.format(out))

### FIXED CODE ###

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

if a > 9 or b > 9:
	print("-1")
else:
	out = a * b
	print('{0}'.format(out))
n=int(input())
ans=0
for i in range(n):
  j=n//i
  ans+=j*(j+1)//2
print(ans)

### FIXED CODE ###

n=int(input())
ans=0
for i in range(1,n+1):
  j=n//i
  ans+=i*j*(j+1)//2
print(ans)
n=int(input())
s=[input() for i in range(n)]

dic={}
for i in s:
    if i[0]=='M' or i[0]=='A' or i[0]=='R' or i[0]=='C' or i[0]=='H':
        if i[0] in dic:
            dic[i[0]]+=1
        else:
            dic[i[0]]=1
if len(dic)<3:
    ans=0
else:
    if len(dic)==3:
        ans = 1
        for i in dic.values():
            ans *=i
    elif len(dic)==4:
        li4 = []
        for i in dic.values():
            li4.append(i)
        ans = li4[0]*li4[1]*li4[2]+li4[0]*li4[1]*li4[3]+li4[0]*li4[2]*li4[3]+li4[1]*li4[2]*li4[3]
    else:
        li4 = []
        for i in dic.values():
            li5.append(i)
        ans =li5[0]*li5[1]*li5[2]+li5[0]*li5[1]*li5[3]+li5[0]*li5[1]*li5[4]+li5[0]*li5[2]*li5[3]+li5[0]*li5[2]*li5[4]+li5[0]*li5[3]*li5[4]+li5[1]*li5[2]*li5[3]+li5[1]*li5[2]*li5[4]+li5[1]*li5[3]*li5[4]+li5[2]*li5[3]*li5[4]
print(ans)


### FIXED CODE ###

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

dic={}
for i in s:
    if i[0]=='M' or i[0]=='A' or i[0]=='R' or i[0]=='C' or i[0]=='H':
        if i[0] in dic:
            dic[i[0]]+=1
        else:
            dic[i[0]]=1
if len(dic)<3:
    ans=0
else:
    if len(dic)==3:
        ans = 1
        for i in dic.values():
            ans *=i
    elif len(dic)==4:
        li4 = []
        for i in dic.values():
            li4.append(i)
        ans = li4[0]*li4[1]*li4[2]+li4[0]*li4[1]*li4[3]+li4[0]*li4[2]*li4[3]+li4[1]*li4[2]*li4[3]
    else:
        li5 = []
        for i in dic.values():
            li5.append(i)
        ans =li5[0]*li5[1]*li5[2]+li5[0]*li5[1]*li5[3]+li5[0]*li5[1]*li5[4]+li5[0]*li5[2]*li5[3]+li5[0]*li5[2]*li5[4]+li5[0]*li5[3]*li5[4]+li5[1]*li5[2]*li5[3]+li5[1]*li5[2]*li5[4]+li5[1]*li5[3]*li5[4]+li5[2]*li5[3]*li5[4]
print(ans)
import numpy as np
from collections import deque


h, w = map(int, input().split())
a = []
d = deque([])
memo = [[-1]*w for j in range(h)]
for i in range(h):
    a.append(list(input()))
    for j, s in enumerate(a[i]):
        if s == '#':
            d.append([i, j])
            memo[i][j] = 0


def d_list_update(d, hmax, wmax):
    move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
    dh, dw = d.popleft()
    for i, j in move:
        if (0 <= dh + i < hmax) and (0 <= dw + j < wmax):
            if memo[dh + i][dw + j] == -1:
                memo[dh + i][dw + j] = memo[dh][dw] + 1
                d.append([dh + i, dw + j])
    return d


def abc(d, hmax, wmax):
    d = d_list_update(d, hmax, wmax)
    if d:
        abc(d, hmax, wmax)
    return 0


abc(d, h, w)
ans = np.amax(np.array(memo))
print(ans)

### FIXED CODE ###

from collections import deque
 
 
h, w = map(int, input().split())
hs, ws = set(range(h)), set(range(w))
d = deque()
memo = [[-1] * w for j in hs]
move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
a = tuple(input() for _ in hs)
b = [[i, j] for i in hs for j in ws if a[i][j] == '#']
for i, j in b:
    d.append((i, j))
    memo[i][j] = 0
while d:
    dh, dw = d.popleft()
    for i, j in move:
        dhn, dwn = dh + i, dw + j
        if (0 <= dhn < h) and (0 <= dwn < w) and (memo[dhn][dwn] < 0):
            d.append((dhn, dwn))
            memo[dhn][dwn] = memo[dh][dw] + 1
ans = max([max(e) for e in memo])
print(ans)
S = input()
S[3]="8"
print(S)

### FIXED CODE ###

S = input()
print(S[:3]+"8"+S[4:])
n,x=map(int,input().split())
a=list(map(int,input().split()))
dp=[-1]*n
dp[0]=0
if n=<x:
    x=n-1
for i in range(1,x+1):
    dp[i]=abs(a[i]-a[0])

for i in range(x+1,n):
    min1=10**9
    for j in range(i-(x),i):  
        if min1>dp[j]+abs(a[j]-a[i]):               
            min1=dp[j]+abs(a[j]-a[i])
    dp[i]=min1
print(dp[-1])


### FIXED CODE ###

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

dp=[-1]*n
dp[0]=0
dp[1]=abs(a[0]-a[1])

for i in range(2,n):
    dp[i]=min(
        dp[i-2]+abs(a[i]-a[i-2]),
        dp[i-1]+abs(a[i]-a[i-1])
    )
    
print(dp[-1])
from fractions import gcd
 
def primeNum(n):
  prime=[1]
  if n % 2 == 0:
    prime.append(2)
    while n % 2 == 0:
      n = n // 2
  for k in range(3, n+1, 2):
    if n % k == 0:
      prime.append(k)
      while n % k == 0:
        n = n // k
    if n == 1:
      return prime
 
a,b = list(map(int, input().split()))
n=gcd(a,b)
print(len(primeNum(n)))

### FIXED CODE ###

from fractions import gcd
 
def primeNum(n):
  ans = 1
  if n == 1:
    return ans
  if n % 2 == 0:
    ans += 1
    while n % 2 == 0:
      n = n // 2
  for k in range(3, int(n**0.5)+1, 2):
    if n % k == 0:
      ans += 1
      while n % k == 0:
        n = n // k
    if n == 1:
      return ans
  if n != 1:
    ans += 1
  return ans
  
a,b = list(map(int, input().split()))
n=gcd(a,b)
print(primeNum(n))
def zengo(l,n):
    if n<l[0]:
        return 0,l[0]-n
    elif n>l[-1]:
        return n-l[-1],0
    else:
        st=0
        ed=len(l)
        while ed-st>1:
            md=(st+ed)//2
            if n<l[md]:
                ed=md
            else:
                st=md
        return n-l[st],l[ed]-n

near=lambda x,y:min(x,y) if x*y else max(x,y)

jn,tn,qn,*tmp=map(int,open(0).read.split())
jz=tmp[:jn]
tz=tmp[jn:jn+tn]
q=tmp[jn+tn:]
for i in q:
    jb,jf=zengo(jz,i)
    tb,tf=zengo(tz,i)
    ans=[]
    if jb*tb:
        ans.append(max(jb,tb))
    if jf*tf:
        ans.append(max(jf,tf))
    jd=near(jb,jf)
    td=near(tb,tf)
    ans.append(jd+td+min(jd,td))
    print(min(ans))

### FIXED CODE ###

def zengo(l,n):
    if n<l[0]:
        return 0,l[0]-n
    elif n>l[-1]:
        return n-l[-1],0
    else:
        st=0
        ed=len(l)
        while ed-st>1:
            md=(st+ed)//2
            if n<l[md]:
                ed=md
            else:
                st=md
        return n-l[st],l[ed]-n

near=lambda x,y:min(x,y) if x*y else max(x,y)

jn,tn,qn,*tmp=map(int,open(0).read().split())
jz=tmp[:jn]
tz=tmp[jn:jn+tn]
q=tmp[jn+tn:]
for i in q:
    jb,jf=zengo(jz,i)
    tb,tf=zengo(tz,i)
    ans=[]
    if jb*tb:
        ans.append(max(jb,tb))
    if jf*tf:
        ans.append(max(jf,tf))
    jd=near(jb,jf)
    td=near(tb,tf)
    ans.append(jd+td+min(jd,td))
    print(min(ans))
a,b,c,x=map(int,input().split())
val=0
ans=0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*500+j*100+k*50==x:
                ans+=1
print(ans) 

### FIXED CODE ###

a,b,c,x=[int(input()) for i in range(4)]
ans=0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*500+j*100+k*50==x:
                ans+=1
print(ans)
int a,b=map(int,input().split())

if a<=5:
    print(0)
elif a>=12:
    print(b)
else:
    print(b//2)

### FIXED CODE ###

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

if a<=5:
    print("0")
elif a>=13:
    print(b)
else:
    print(b//2)
a, b = input().split()
b.replace(".", "")
a = int(a)
b = int(b)
print(a*b//100)


### FIXED CODE ###

a, b = input().split()
b = int(b.replace(".", ""))
a = int(a)
print(a*b//100)
N,Q = map(int,input().split(' '))

tree = {i:[] for i in range(1,N+1)}
sub = {i:[i] for i in range(1,N+1)}
fin = [False]*(N+1)
vals = [0]*(N+1)

for i in [0]*(N-1):
	a,b = map(int,input().split(' '))
	tree[a].append(b)

def get_sub(p):
	if not fin[p]:
		for t in tree[p]:
			sub[p].extend(get_sub(t))
		fin[p] = True
	return sub[p]

for i in [0]*Q:
	p,x = map(int,input().split(' '))
	subtree = get_sub(p)
	for t in subtree:
		vals[t] += x
#print(tree)
#print(sub)

print(' '.join(map(str,vals[1:])))






### FIXED CODE ###

from collections import deque
N,Q = map(int,input().split(' '))

tree = {i:[] for i in range(1,N+1)}
#sub = {i:[i] for i in range(1,N+1)}
#fin = [False]*(N+1)
vals = [0]*(N+1)
#parent = [0]*(N+1)

for i in [0]*(N-1):
	a,b = map(int,input().split(' '))
	tree[a].append(b)
	#parent[b] = a

for i in [0]*Q:
	p,x = map(int,input().split(' '))
	vals[p] += x

ans = [0]*(N+1)

ans[1] = vals[1]

dq = deque([1])
while(dq):
	n = dq.popleft()
	for t in tree[n]:
		ans[t] = vals[t]+ans[n]
		dq.append(t)

print(' '.join(map(str,ans[1:])))
import datetime

t = datetime.time(1, 2, 3)
print t
print 'hour  :', t.hour
print 'minute:', t.minute
print 'second:', t.second

### FIXED CODE ###

S = int(input())
h = int(S / (60 * 60))
m = int(S / 60) % 60
s = S % 60 

print('{}:{}:{}'.format(h,m,s))
N, K = map(int, input().split())
A = list(map(int, input().split()))
way = A[0]
List = [0 for n in range(N)]
List[way-1] += 1
count = 0
string = f"{way}"
#print(f"string:{string}")
#print(f"way:{way}")

for i in range(10**7):
    way = A[way-1]
    List[way-1] += 1 
    count += 1
    #print(f"way:{way}")
    #print(f"count:{count}")
    #print(List)
    if max(List) == 3:
        break
    else:
        string += f"{way}"
        #print(f"string:{string}")
        #print()

#print(List)
#print()
new_list = [i for i in List if i == 1]
length = len(new_list)
n_list = [j for j in List if j >= 2]
#print(new_list)
#print(n_list)
amari = (K - length)% len(n_list)

print(int(n_list[amari+1]))


### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))# 0index
visi = [-1 for i in range(N)]# 訪れたタイミングを記録(-1: 訪れてない)
L = [1] # 今いる町を追加(町番号:1index)
visi[0] = 0
way = A[0] #次に向かう町の番号を取得
#l = []
count = 1

while visi[way-1] == -1: #すでに訪れた町が出てくるまでループ
    visi[way-1] = count
    count += 1
    L.append(way)
    way = A[way-1]

l = count - visi[way-1]
l_pre = visi[way-1]
loop_L = L[l_pre:]



if K > l_pre:
    index = (K- l_pre)% l
    ans = loop_L[index]
else:
    ans = L[K]
print(ans)
def happy_birthday(A: int, B: int) -> bool:
    return A <= 8 and B <= 8:


if __name__ == "__main__":
    A, B = map(int, input().split())
    yes = happy_birthday(A, B)
    print('Yay!' if yes else ':(')


### FIXED CODE ###

def happy_birthday(A: int, B: int) -> bool:
    return A <= 8 and B <= 8


if __name__ == "__main__":
    A, B = map(int, input().split())
    yes = happy_birthday(A, B)
    print('Yay!' if yes else ':(')
#%%
n = int(input())
a, b, c = [0] * n, [0] * n, [0] * n
for i in range(n-1):
    a[i], b[i], c[i] = map(int, input().split())

q, k = map(int, input().split())
x, y = [0] * q, [0] * q
for i in range(q):
    x[i], y[i] = map(int, input().split())

l = [[] for _ in range(n+1)]
for i in range(n-1):
    l[a[i]].append((b[i],c[i]))
    l[b[i]].append((a[i],c[i]))

d = [0] * (n+1)
check = False * (n+1)
check[k] = 1
que = [k]

while len(que) > 0:
    tmp = que.pop(0)
    for i in l[tmp]:
        if check[i[0]] :
            que.append(i[0])
            check[i[0]] = True
            d[i[0]] = d[tmp] + i[1]
        else:
            pass

for i in range(q):
    ans = d[x[i]] + d[y[i]]
    print(ans)

### FIXED CODE ###

#%%
n = int(input())
a, b, c = [0] * n, [0] * n, [0] * n
for i in range(n-1):
    a[i], b[i], c[i] = map(int, input().split())

q, k = map(int, input().split())

l = [[] for _ in range(n+1)]
for i in range(n-1):
    l[a[i]].append([b[i],c[i]])
    l[b[i]].append([a[i],c[i]])

d = [0] * (n+1)
check = [0] * (n+1)
check[k] = 1
que = [k]
count = 1

while len(que) > 0:
    tmp = que.pop(0)
    for i in l[tmp]:
        if check[i[0]] == 0:
            que.append(i[0])
            check[i[0]] = 1
            d[i[0]] = d[tmp] + i[1]
            count += 1
        else:
            pass
    if count >= n:
        break

x, y = [0] * q, [0] * q
for i in range(q):
    x[i], y[i] = map(int, input().split())
    print(d[x[i]] + d[y[i]])
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

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

#############
# Main Code #
#############

S = input()

l = [null,"SAT","FRI","THU","WED","TUE","MON","SUN"]

for i in range(7):
  if S == l[i]:
    print(i)

### FIXED CODE ###

S = input()
 
l = [None,"SAT","FRI","THU","WED","TUE","MON","SUN"]
 
for i in range(8):
  if S == l[i]:
    print(int(i))