program borlpasc;{составить программу перевода римских чисел в арабские}
var s:string; {ВЕРНА!!!!}
n,c,c1,i,a:integer;
begin writeln('введите число:');
readln(s);
c:=0;n:=0;
for i:=1 to length(s) do
begin
c1:=c;
if s[i]='I' then c:=1;
if s[i]='V' then c:=5;
if s[i]='X' then c:=10;
if s[i]='L' then c:=50;
if s[i]='C' then c:=100;
if s[i]='D' then c:=500;
if s[i]='M' then c:=1000;
if c>c1 then a:=-2*c1
else a:=0;
n:=n+a+c
end;
writeln('ваше число=',n)
end.