# Python code for 8315. Number to Word Problem code: NUMWORD
t="teen"
N="nine"
S="seven"
U={0:'zero' ,1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:S,8:'eight',9:N,10:'ten',11:'eleven',12:'twelve',13:'thir'+t,14:'four'+t,15:'fif'+t,16:'six'+t,17:S+t,18:'eigh'+t,19:N+t,20:'twenty',30:'thirty',40:'forty',50:'fifty',60:'sixty',70:S+'ty',80:'eighty',90:N+'ty',100:'hundred',1000:'thousand'}
def f(m):return U.get(m)
n=input()
b=len(str(n))-1
T=10
if b>3:b=3
k=T**b
if b==0:print f(n),
while n:
m=n/k
if k==T:
m=n/T
s=n%T
if s:
x=f(m*T+s)
if x:print x,
else:print f(m*T),f(s),
else:print f(m*T),
if k>T:
x=f(m)
y=f(k)
if x:
if m:print x,y,
else:
x=m/T
z=m%T
X=f(x*T)
if z:print X,f(z),y,
else:print X,y,
n%=k
if n==0:print
k/=T
t="teen"
N="nine"
S="seven"
U={0:'zero' ,1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:S,8:'eight',9:N,10:'ten',11:'eleven',12:'twelve',13:'thir'+t,14:'four'+t,15:'fif'+t,16:'six'+t,17:S+t,18:'eigh'+t,19:N+t,20:'twenty',30:'thirty',40:'forty',50:'fifty',60:'sixty',70:S+'ty',80:'eighty',90:N+'ty',100:'hundred',1000:'thousand'}
def f(m):return U.get(m)
n=input()
b=len(str(n))-1
T=10
if b>3:b=3
k=T**b
if b==0:print f(n),
while n:
m=n/k
if k==T:
m=n/T
s=n%T
if s:
x=f(m*T+s)
if x:print x,
else:print f(m*T),f(s),
else:print f(m*T),
if k>T:
x=f(m)
y=f(k)
if x:
if m:print x,y,
else:
x=m/T
z=m%T
X=f(x*T)
if z:print X,f(z),y,
else:print X,y,
n%=k
if n==0:print
k/=T
No comments:
Post a Comment