codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
s=p=0 for x in raw_input():x=dict(zip('IVXLCDM',(1,5,10,50,100,500,1000)))[x];s+=(x,x-p-p)[p<x];p=x print s
Private
[
?
]
Run code