Chinese/Japanese numbers to Arabic numerals

In Chinese and Japanese, here are the numbers one to ten next to the equivelant number:

1一
2二
3三
4四
5五
6六
7七
8八
9九
10十

They are also written in a different way to Arabic numerals:

三十 (three, ten) = 30
四十七 (four, ten, seven) = 47

As you can see, they're written in order from biggest to smallest, except when a number under 10 is used to multiply another number.

Your task is to convent any number under 99 from Chinese/Japanese format to Arabic format.

IN

三十

OUT

30

IN

四十七

OUT

47

IN

六十三

OUT

63

IN

三十八

OUT

28

IN

八十九

OUT

89
Login to submit solution


21 symbols pyth
Wed Nov 23 18:37:20 2016 Sait2000
@[28kk47kk89 30 63)Cz
38 symbols pyth
Sat Nov 12 04:10:56 2016 Sait2000
-Ki%2mxiR32"a0c9rkd3bt"%Cd32+zbT*Tq38K
39 symbols pyth
Sat Nov 12 04:06:07 2016 Sait2000
-Ki%2mxiR32"10c9rkd3bt"%Cd32+z\!T*Tq38K
42 symbols pyth
Sat Nov 12 03:51:33 2016 Sait2000
-K+*TxJiR32"10c9rkd3bt"h=%R32CMzxJez*Tq38K
44 symbols pyth
Tue Oct 25 15:54:46 2016 Sait2000
-K+*TxJm%Cd64"A@LI[TmCk]"h=%R64CMzxJez*Tq38K
45 symbols pyth
Fri Oct 21 18:43:12 2016 Sait2000
-K+*TxJm%Cd64"A@LI[TmCk]"%Chz64xJ%Cez64*Tq38K
49 symbols pyth
Fri Oct 21 18:35:08 2016 Sait2000
-K+*TxJm%Cd64%3tt"十一二三四五六七八九"%Chz64xJ%Cez64*Tq38K
69 symbols python3
Mon Sep 12 17:10:00 2016 Sait2000
a='十一二三四五六七八九'.find
s=input()
print((a(s[0])-(s=='三十八'))*10+a(s[-1]))
70 symbols python3
Mon Sep 12 17:08:24 2016 Sait2000
a='十一二三四五六七八九'.find
s=input()
print(a(s[0])*10+a(s[-1])-10*(s=='三十八'))
74 symbols python3
Fri Jan 15 21:56:19 2016 Sait2000
a='十一二三四五六七八九'.find
s=input()
print({'三十八':28}.get(s,a(s[0])*10+a(s[-1])))
78 symbols bash
Mon Jul 25 05:26:19 2016 hidefromkgb
c='\211\255\203\253\235';tr -dc $c|tr $c 36789|sed 's/7/47/;s/38/28/;s/^3/30/'
85 symbols python3
Thu Oct 8 15:25:35 2015 BogdanShevchenko
a='十一二三四五六七八九'
d={'三十八':28}
s=input()
print(d.get(s,a.index(s[0])*10+a.index(s[-1])))
89 symbols bash
Mon Jul 25 05:18:01 2016 hidefromkgb
c='\214\211\233\255\203\253\235';tr -dc $c|tr $c 2346789|tr -s 4|sed 's/^.$/&0/;s/38/28/'
113 symbols python3
Thu Oct 8 15:07:25 2015 BogdanShevchenko
a='十一二三四五六七八九'
s=input()
I=a.index(s[0])
if s=='三十八':print(28)
else:print((I,I*10,I*10+a.index(s[-1]))[len(s)-1])
119 symbols haskell
Fri Jul 3 06:53:40 2015 YoshikuniJujo
import Data.List
main=interact$show.i
j=head.(`elemIndices`"零一二三四五六七八九十")
i"三十八"=28
i(e:_:f)=j e*10+i f
i e=sum$j`map`e

View all solutions