@@ -0,0 +1,1623 @@
+import java.util.Scanner;%0A%0Apublic class Main %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        Scanner sc = new Scanner(System.in);%0A%0A        while (sc.hasNext()) %7B%0A%0A            String input = sc.next();%0A%0A            int%5B%5D romanNumerals = new int%5Binput.length()%5D;%0A%0A            for (int i = 0; i %3C input.length(); i++) %7B%0A%0A                switch (input.charAt(i)) %7B%0A                    case 'I' :%0A                        romanNumerals%5Bi%5D = 1;%0A                        break;%0A                    case 'V' :%0A                        romanNumerals%5Bi%5D = 5;%0A                        break;%0A                    case 'X' :%0A                        romanNumerals%5Bi%5D = 10;%0A                        break;%0A                    case 'L' :%0A                        romanNumerals%5Bi%5D = 50;%0A                        break;%0A                    case 'C' :%0A                        romanNumerals%5Bi%5D = 100;%0A                        break;%0A                    case 'D' :%0A                        romanNumerals%5Bi%5D = 500;%0A                        break;%0A                    case 'M' :%0A                        romanNumerals%5Bi%5D = 1000;%0A                        break;%0A                %7D%0A%0A            %7D%0A%0A            int prev = 0;%0A            int arabicNumerals = 0;%0A%0A            for (int i = input.length() - 1; i %3E= 0; i--) %7B%0A%0A                if (prev %3C= romanNumerals%5Bi%5D) %7B%0A                    arabicNumerals += romanNumerals%5Bi%5D;%0A                %7D else %7B%0A                    arabicNumerals -= romanNumerals%5Bi%5D;%0A                %7D%0A%0A                prev = romanNumerals%5Bi%5D;%0A%0A            %7D%0A%0A            System.out.println(arabicNumerals);%0A%0A        %7D%0A%0A    %7D%0A%0A%7D%0A

Create : 0039