R2N = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000}
def roman2num(s):
r = 0
n = len(s)
for i, ch in enumerate(s):
v = rc[ch]
if i < n-1 and v < R2N[s[i+1]]:
r -= v
else:
r += v
return r;
s = input("请输入一个罗马字符:")
v = roman2num(s)
print(f"转换后的结果是:{v}")