l,r=map(int,input().split())
#除以3的余数100100100100
if l%3==2:
flagl=1
else:
flagl=0
if r%3==2:
flagr=1
else:
flagr=0
str1=(l-1)//3*2+flagl
str2=r//3*2+flagr
print(str2-str1)
t=int(input())
for i in range(t):
n=int(input())
s=input()
j=0
answer=0
while j<n:
if s[j]=='.':
answer+=1
j+=3
else:
j+=1
print(answer)
n=int(input())
s=input()
l=0
r=0
str1=['N','E','S','W']
str2=['N','W','S','E']
for i in s:
if i=='L':
l+=1
else:
r+=1
if l>r:
print(str2[(l-r)%4])
elif r>l:
print(str1[(r-l)%4])
else:
print('N')
n,k=map(int,input().split())
count=0
for x in range(1,n+1):
for y in range(k+1,n+1):
if x%y>=k:
count+=1
print(count)
def gcd(a, b):
"""Return greatest common divisor using Euclid's Algorithm."""
while b:
a, b = b, a % b
return a
def lcm(a, b):
"""Return lowest common multiple."""
return a * b // gcd(a, b)
while True:
try:
a,b=map(int,input().split())
print(lcm(a,b))
except:
break
def lifang(n):
return n**(1/3)
n=float(input())
print('%0.1f'%lifang(n))
str=input()
print(str[::-1])
a,zheng,fu=input().split(),[],[]
for i in a:
fu.append(int(i)) if int(i)<0 else zheng.append(int(i))
count=len(fu)
print(count)
print(round(sum(zheng)/len(zheng),1)if zheng else "0.0")
while True:
try:
n=int(input())
for i in range(n):
s=input()
while len(s)>8:
print(s[:8])
s=s[8:]
print(s.ljust(8,'0'))
except:
break
while True:
try:
list1=[]
arr = input()
dic = {}
for i in arr:
if not (i.isalpha() or i.isdigit() or i.isspace()):
continue
else:
if i in dic:
dic[i] += 1
else:
dic[i]=1
dic=sorted(dic.items(),key = lambda x:x[0])#先按字符ASC排
dic=sorted(dic,key = lambda x:x[1],reverse=True)#再按统计数目排
print(''.join(k for (k , v) in dic))
except:
break
while True:
try:
a,b,c=input(),map(int,input().split()),input()
print(" ".join(map(str,sorted(b))) if c=="0" else " ".join(map(str,sorted(b,reverse=True))))
except:break
while True:
try:
n=int(input())
data_list=map(int,input().split())
num=0
res=0
geshu=0
for i in data_list:
if i>0:
num+=1
res+=i
elif i<0:
geshu+=1
res = res/num
print("%d %.1f"%(geshu,res))
except:
break
while True:
try:
n=int(input())
count=0
for i in range(0,n+1):
a=i**2
if i==a%(10**len(str(i))):
count+=1
print(count)
except:
break
while True:
try:
n=int(input())
ans=0
for i in range(n):
ans+=2+3*i
print(ans)
except:
#print('-1')
break
while True:
try:
a,b,c=input(),map(int,input().split()),input()
if c=='0':
print(' '.join(map(str,sorted(b)))
else:
print(' '.join(map(str,sorted(b,reverse=True))))
except:
break
while True:
try:
list1=[]
arr = input()
dic = {}
for i in arr:
if not (i.isalpha() or i.isdigit() or i.isspace()):
continue
else:
if i in dic:
dic[i] += 1
else:
dic[i]=1
dic=sorted(dic.items(),key = lambda x:x[0])#先按字符ASC排
dic=sorted(dic,key = lambda x:x[1],reverse=True)#再按统计数目排
print(''.join(k for (k , v) in dic))
except:
break
def longestPalindrome(s):
if s==s[::-1]:return len(s)
maxLen=0
for i in range(len(s)):
if i-maxLen>=1 and s[i-maxLen-1:i+1]==s[i-maxLen-1:i+1][::-1]:
maxLen+=2
continue
if i-maxLen>=0 and s[i-maxLen:i+1]==s[i-maxLen:i+1][::-1]:
maxLen+=1
return maxLen
while True:
try:
a=input()
if a:
print(longestPalindrome(a))
except:
break
while True:
try:
n, curNum = int(input()), 1
res = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
for j in range(i + 1):
res[i - j][j] = curNum
curNum += 1
for i in res:
print(" ".join(map(str, (filter(lambda i: i != 0, i)))))
except:
break
while True:
try:
#key,string分别代表输入的key的加要密的字符串
#chars是密钥对应的字母表,res是要返回的结果。
key, string, chars, res = input(), input(), [], ""
#经过下面的循环,chars前面几个是密匙的字母
for i in key:
if i not in chars:
chars.append(i)
#如果输入的key中有小写字母,转为大写字母。
chars = list(map(lambda c: c.upper(), chars))
#剩下的字母,填充到chars里面。
for i in range(65, 91):
if chr(i) not in chars:
chars.append(chr(i))
# 将输入加密。
for i in string:
if i.isupper():
res += chars[ord(i) - 65]
elif i.islower():
res += chars[ord(i) - 97].lower()
else:
res += i
print(res)
except:
break
# -*- coding: utf-8 -*-
# !/usr/bin/python3
# 解题思路:动态规划dp[i][j]表示st1[0:j - 1]和st2[0:i - 1]的最小距离;
# 那么st1和st2的距离与dp[i][j], dp[i - 1][j]和dp[i][j - 1]有关;
# 如果st1[j] == st2[i], dp[i + 1][j + 1] = dp[i - 1][j - 1];
# 如果st1[j] != st2[i], dp[i + 1][j + 1] = min(dp[i - 1][j - 1], dp[i - 1][j] + 1, dp[i][j - 1] + 1);
# 边界条件:第0行和第0列表示空字符串分别于st1和st2的子字符串的距离,dp[i][0] = i, dp[0][j] = j
while True:
try:
st1 = input()
st2 = input()
if len(st1) < len(st2):
st1, st2 = st2, st1
m = len(st1)
n = len(st2)
res = [[0 for i in range(m + 1)] for i in range(n + 1)]
for i in range(n + 1):
res[i][0] = i
for j in range(m + 1):
res[0][j] = j
for i in range(1, n + 1):
for j in range(1, m + 1):
if st1[j - 1] == st2[i - 1]:
res[i][j] = res[i - 1][j - 1]
else:
res[i][j] = min(res[i - 1][j - 1] + 1, res[i - 1][j] + 1, res[i][j - 1] + 1)
print(res[n][m])
except:
break
import sys
while True:
try:
string = sys.stdin.readline()
line = int(string)
if line == 1 or line == 2:
print(-1)
elif line == 3:
print(2)
elif line%4==1 or line%4==3:
print(2)
elif line%4==2:
print(4)
else:
print(3)
except:
break
#找规律吧,小伙伴们~
while True:
try:
a=int(input())
count=0
for i in range(1,a+1):
if i%7==0:
count+=1
elif '7' in str(i):
count+=1
else:
continue
print(int(count))
except:
break