input: Write a python function to convert a Roman numeral string to an integer.
  assert solve_roman("III") == 3
  assert solve_roman("IV") == 4
  assert solve_roman("IX") == 9
  assert solve_roman("LVIII") == 58
  assert solve_roman("MCMXCIV") == 1994
output: def solve_roman(s):
      roman_to_int = {
          'I': 1, 'V': 5, 'X': 10, 'L': 50,
          'C': 100, 'D': 500, 'M': 1000
      }
      total = 0
      prev_value = 0
      
      for char in reversed(s):
          value = roman_to_int[char]
          if value >= prev_value:
              total += value
          else:
              total -= value
          prev_value = value
      
      return total