public static int romanToInt(String s) {//accepted
        if (s == null) {
            return 0;
        }
        int len = s.length();
        int val = 0;
        for (int i = 0; i < len; ++i) {
            val += c2n(s.charAt(i));
            int t = i;
            while (t > 0 && c2n(s.charAt(t)) > c2n(s.charAt(t-1))) {
                val -= 2*c2n(s.charAt(t-1));
                --t;
            }
        }
        System.out.println(val);
        return val;
    }