def romanToInt(s):
symbols = dict(I=1, V=5, X=10, L=50, C=100, D=500, M=1000)
c_prev = 'M' # greatest value
out = []
for i in range(len(s)):
c = s[i]
print(c)
if symbols[c] > symbols[c_prev]:
f=symbols[c] - 2 * symbols[c_prev]
out.append(f)
else:
out.append(symbols[c])
c_prev = c
print(out)
return sum(out)
romanToInt("LVIII")