{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cstyle type\u003d\"text/css\"\u003e\r\n\u003c/style\u003e\r\n\u003cdiv align\u003d\"center\"\u003e\r\n\t\u003ccenter\u003e\r\n\t\t\u003ctable bgcolor\u003d\"#0060F0\" border\u003d\"0\"\u003e\r\n\t\t\t\u003ctbody\u003e\r\n\t\t\t\t\u003ctr\u003e\r\n\t\t\t\t\t\u003ctd\u003e\r\n\t\t\t\t\t\t\u0026nbsp;\u003c/td\u003e\r\n\t\t\t\t\u003c/tr\u003e\r\n\t\t\t\u003c/tbody\u003e\r\n\t\t\u003c/table\u003e\r\n\t\u003c/center\u003e\r\n\u003c/div\u003e\r\n\u003ch2\u003e\r\n\t\u003cfont color\u003d\"#0070E8\"\u003eContext\u003c/font\u003e\u003c/h2\u003e\r\n\u003cp\u003e\r\n\tThis year is the \u003cspan data-scayt_word\u003d\"XXV\" data-scaytid\u003d\"1\"\u003eXXV\u003c/span\u003e Anniversary of the Faculty of Computer Science in Murcia. But, what \u003cspan data-scayt_word\u003d\"XXV\" data-scaytid\u003d\"2\"\u003eXXV\u003c/span\u003e means? Maybe you should ask an ancient Roman to get the answer.\u003c/p\u003e\r\n\u003ch2\u003e\r\n\t\u003cfont color\u003d\"#0070E8\"\u003eThe Problem\u003c/font\u003e\u003c/h2\u003e\r\n\u003cp\u003e\r\n\tA Roman numeral consists of a set of letters of the alphabet. Each letter has a particular value, as shown in the following table:\u003c/p\u003e\r\n\u003ctable align\u003d\"center\" border\u003d\"1\"\u003e\r\n\t\u003ctbody\u003e\r\n\t\t\u003ctr\u003e\r\n\t\t\t\u003ctd width\u003d\"60\"\u003e\r\n\t\t\t\tLetter\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\tI\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\tV\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\tX\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\tL\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\tC\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\tD\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\tM\u003c/td\u003e\r\n\t\t\u003c/tr\u003e\r\n\t\t\u003ctr\u003e\r\n\t\t\t\u003ctd width\u003d\"60\"\u003e\r\n\t\t\t\tValue\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\t1\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\t5\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\t10\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\t50\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\t100\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\t500\u003c/td\u003e\r\n\t\t\t\u003ctd align\u003d\"center\" width\u003d\"50\"\u003e\r\n\t\t\t\t1000\u003c/td\u003e\r\n\t\t\u003c/tr\u003e\r\n\t\u003c/tbody\u003e\r\n\u003c/table\u003e\r\n\u003cp\u003e\r\n\tGenerally, Roman numerals are written in descending order from left to right, and are added sequentially. However, certain combinations employ a subtractive principle. If a symbol of smaller value precedes a symbol of larger value, the smaller value is subtracted from the larger value, and the result is added to the total. This subtractive principle follows the next rules:\u003c/p\u003e\r\n\u003cul\u003e\r\n\t\u003cli\u003e\r\n\t\t\u0026quot;I\u0026quot; may only precede \u0026quot;V\u0026quot; and \u0026quot;X\u0026quot; (e.g., IV\u003d4).\u003c/li\u003e\r\n\t\u003cli\u003e\r\n\t\t\u0026quot;X\u0026quot; may only precede \u0026quot;L\u0026quot; and \u0026quot;C\u0026quot; (e.g., \u003cspan data-scayt_word\u003d\"XC\" data-scaytid\u003d\"3\"\u003eXC\u003c/span\u003e\u003d90).\u003c/li\u003e\r\n\t\u003cli\u003e\r\n\t\t\u0026quot;C\u0026quot; may only precede \u0026quot;D\u0026quot; and \u0026quot;M\u0026quot;.\u003c/li\u003e\r\n\t\u003cli\u003e\r\n\t\t\u0026quot;V\u0026quot;, \u0026quot;L\u0026quot; and \u0026quot;D\u0026quot; are always followed by a symbol of smaller value, so they are always added to the total.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003e\r\n\tSymbols \u0026quot;I\u0026quot;, \u0026quot;X\u0026quot;, \u0026quot;C\u0026quot; and \u0026quot;M\u0026quot; cannot appear more than three consecutive times. Symbols \u0026quot;V\u0026quot;, \u0026quot;L\u0026quot; and \u0026quot;D\u0026quot; cannot appear more than once consecutively.\u003c/p\u003e\r\n\u003cp\u003e\r\n\tRoman numerals do not include the number zero, and for values greater or equal than 4000 they used bars placed above the letters to indicate multiplication by 1000.\u003c/p\u003e\r\n\u003cp\u003e\r\n\tYou have write a program that converts from Roman to Arabic numerals and vice versa. Although lower case letters were used in the Middle Ages, the Romans only used upper case letters. Therefore, for the Roman numerals we only consider upper case letters.\u003c/p\u003e\r\n\u003ch2\u003e\r\n\t\u003cfont color\u003d\"#0070E8\"\u003eThe Input\u003c/font\u003e\u003c/h2\u003e\r\n\u003cp\u003e\r\n\tThe input consists of several lines, each one containing either an Arabic or a Roman number \u003cem\u003en\u003c/em\u003e, where 0 \u0026lt; \u003cem\u003en\u003c/em\u003e \u0026lt; 4000.\u003c/p\u003e\r\n\u003ch2\u003e\r\n\t\u003cfont color\u003d\"#0070E8\"\u003eThe Output\u003c/font\u003e\u003c/h2\u003e\r\n\u003cp\u003e\r\n\tFor each input line, you must print a line with the converted number. If the number is Arabic, you must give it in Roman format. If the number is Roman, you must give it in Arabic format.\u003c/p\u003e\r\n\u003ch2\u003e\r\n\t\u003cfont color\u003d\"#0070E8\"\u003eSample Input\u003c/font\u003e\u003c/h2\u003e\r\n\u003cpre\u003e\r\n\u003cspan data-scayt_word\u003d\"XXV\" data-scaytid\u003d\"5\"\u003eXXV\u003c/span\u003e\r\n4\r\n942\r\nMCMLXXXIII\r\n\u003c/pre\u003e\r\n\u003ch2\u003e\r\n\t\u003cfont color\u003d\"#0070E8\"\u003eSample Output\u003c/font\u003e\u003c/h2\u003e\r\n\u003cpre\u003e\r\n25\r\nIV\r\nCMXLII\r\n1983\r\n\u003c/pre\u003e\r\n\u003chr /\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tUse map to store everything ;)\u003c/p\u003e"}}]}