public int romanToInt(String s) {
		HashMap<Character, Integer> hash_map = new HashMap<Character, Integer>();
		hash_map.put('M', 1000);
		hash_map.put('D', 500);
		hash_map.put('C', 100);
		hash_map.put('L', 50);
		hash_map.put('X', 10);
		hash_map.put('V', 5);
		hash_map.put('I', 1);
		int result = 0;
		for (int i = 0; i < s.length(); ++i) {
			char c = s.charAt(i);
			if (i > 0 && hash_map.get(c) > hash_map.get(s.charAt(i - 1))) {
				int cur = hash_map.get(c);
				int prev = hash_map.get(s.charAt(i - 1));
				result += (cur - prev * 2);
			} else {
				result += hash_map.get(c);
			}
		}
		return result;
	}