青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

Yiner的ACM

成長的痕跡
<2025年9月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

統計

  • 隨筆 - 29
  • 文章 - 0
  • 評論 - 2
  • 引用 - 0

常用鏈接

留言簿(1)

隨筆分類

隨筆檔案

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

字符串處理 A-Metsys Laremun

 

Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system.

The letters "m", "c", "x" and "i" correspond to 1000, 100, 10 and 1, respectively, and the digits "2", ...,"9" correspond to 2, ..., 9, respectively. This system has nothing to do with the Roman numeral system.

For example, character strings

"5m2c3x4i", "m2c4i" and "5m2c3x"

correspond to the integral numbers 5234 (=5*1000+2*100+3*10+4*1), 1204 (=1000+2*100+4*1), and 5230 (=5*1000+2*100+3*10), respectively. The parts of strings in the above example, "5m", "2c", "3x" and "4i" represent 5000 (=5*1000), 200 (=2*100), 30 (=3*10) and 4 (=4*1), respectively.

 

Each of the letters "m", "c", "x" and "i" may be prefixed by one of the digits "2", "3", ..., "9". In that case, the prefix digit and the letter are regarded as a pair. A pair that consists of a prefix digit and a letter corresponds to an integer that is equal to the original value of the letter multiplied by the value of the prefix digit.

For each letter "m", "c", "x" and "i", the number of its occurrence in a string is at most one. When it has a prefix digit, it should appear together with the prefix digit. The letters "m", "c", "x" and "i" must appear in this order, from left to right. Moreover, when a digit exists in a string, it should appear as the prefix digit of the following letter. Each letter may be omitted in a string, but the whole string must not be empty. A string made in this manner is called an MCXI-string.

An MCXI-string corresponds to a positive integer that is the sum of the values of the letters and those of the pairs contained in it as mentioned above. The positive integer corresponding to an MCXI-string is called its MCXI-value. Moreover, given an integer from 1 to 9999, there is a unique MCXI-string whose MCXI-value is equal to the given integer. For example, the MCXI-value of an MCXI-string "m2c4i" is 1204 that is equal to 1000 + 2*100 + 4*1. There are no MCXI-strings but "m2c4i" that correspond to 1204. Note that strings "1m2c4i", "mcc4i", "m2c0x4i", and "2cm4i" are not valid MCXI-strings. The reasons are use of "1", multiple occurrences of "c", use of "0", and the wrong order of "c" and "m", respectively.

Your job is to write a program for Prof. Hachioji that reads two MCXI-strings, computes the sum of their MCXI-values, and prints the MCXI-string corresponding to the result.

Input

The input is as follows. The first line contains a positive integer n (<= 500) that indicates the number of the following lines. The k+1 th line is the specification of the k th computation (k=1, ..., n).

n
specification1
specification2
...
specificationn

Each specification is described in a line:

MCXI-string1 MCXI-string2

The two MCXI-strings are separated by a space.

 

You may assume that the sum of the two MCXI-values of the two MCXI-strings in each specification is less than or equal to 9999.

Output

For each specification, your program should print an MCXI-string in a line. Its MCXI-value should be the sum of the two MCXI-values of the MCXI-strings in the specification. No other characters should appear in the output.

Sample Input

10
xi x9i
i 9i
c2x2i 4c8x8i
m2ci 4m7c9x8i
9c9x9i i
i 9m9c9x8i
m i
i m
m9i i
9m8c7xi c2x8i

Sample Output

3x
x
6cx
5m9c9x9i
m
9m9c9x9i
mi
mi
mx
9m9c9x9i

posted on 2011-03-20 19:37 Yiner 閱讀(217) 評論(0)  編輯 收藏 引用

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美一区二区私人影院日本 | 国产精品系列在线| 欧美国产在线电影| 91久久精品一区| 欧美日韩国产综合视频在线观看| 一本色道久久综合亚洲精品不| 99re热这里只有精品免费视频| 国产精品久久77777| 亚洲在线成人| 久久青草欧美一区二区三区| 在线观看福利一区| 欧美久久久久中文字幕| 午夜日韩电影| 亚洲黑丝在线| 亚洲在线成人| 在线不卡中文字幕| 欧美日韩中文在线| 久久综合九色欧美综合狠狠| 9色精品在线| 久久在线免费| 一区二区三区四区五区视频| 国产日韩欧美精品| 欧美理论电影在线播放| 亚洲欧美综合| 亚洲免费激情| 美国成人毛片| 午夜精彩国产免费不卡不顿大片| 欧美日韩国产精品一区| 久久成人免费日本黄色| 在线一区二区日韩| 欧美高清不卡在线| 久久精品国产久精国产一老狼| 国产日产精品一区二区三区四区的观看方式 | 欧美大片va欧美在线播放| 亚洲综合第一页| 亚洲欧洲三级电影| 欧美一区影院| 亚洲免费视频观看| 99精品欧美一区二区蜜桃免费| 欧美精品一区二区在线观看| 精品成人a区在线观看| 国产亚洲一区二区三区| 欧美在线欧美在线| 中文av字幕一区| 亚洲精品一区在线| 亚洲国产成人不卡| 欧美成在线视频| 久久久91精品国产一区二区三区 | 亚洲免费观看高清完整版在线观看| 亚洲精品视频二区| 在线精品视频一区二区三四| 国产精品视频一二| 欧美人体xx| 欧美日韩国产精品自在自线| 欧美国产乱视频| 欧美成人一区二免费视频软件| 最新国产成人av网站网址麻豆| 亚洲综合日韩| 亚洲欧美激情视频| 亚洲专区一区二区三区| 性久久久久久久久久久久| 欧美一区二区精品在线| 久久av一区二区三区| 欧美在线观看日本一区| 久久天堂成人| 美腿丝袜亚洲色图| 亚洲国产cao| 99精品热视频| 西西人体一区二区| 久久综合电影| 欧美日韩国产欧美日美国产精品| 欧美在线观看一区二区| 久久久久久午夜| 免费观看久久久4p| 欧美日韩三区四区| 国产欧美一区二区三区另类精品| 免播放器亚洲一区| 欧美日韩性视频在线| 国产精品国产三级欧美二区| 国产欧美精品一区二区色综合| 欧美精品国产精品| 欧美日韩无遮挡| 国语自产精品视频在线看| 亚洲大片在线观看| 亚洲一区二区三区在线播放| 久久久久久穴| 亚洲精品在线视频| 久久国产精品亚洲va麻豆| 欧美77777| 国产精品成av人在线视午夜片| 亚洲香蕉网站| **网站欧美大片在线观看| 亚洲精选久久| 久久精品二区三区| 亚洲片在线观看| 午夜在线一区二区| 欧美日本一区| 亚洲高清中文字幕| 欧美一区二区三区久久精品| 亚洲国产精品一区| 欧美一区观看| 欧美日韩在线看| 91久久国产自产拍夜夜嗨| 亚洲欧美国产毛片在线| 欧美大片一区二区| 欧美一级理论片| 欧美视频在线观看一区二区| 亚洲国产精品免费| 久久精品理论片| 99精品欧美一区二区三区 | 久久国产精品久久久久久| 亚洲国产日韩在线| 久久久久成人精品| 国产日韩欧美| 亚洲欧美日韩一区二区三区在线| 亚洲一区综合| 亚洲黄色成人久久久| 久久这里只有| 亚洲成人自拍视频| 久久免费99精品久久久久久| 亚洲一区二区三区免费在线观看| 亚洲午夜影视影院在线观看| 欧美精品在线免费观看| 亚洲人精品午夜| 葵司免费一区二区三区四区五区| 久久深夜福利免费观看| 欧美一区二区日韩| 国产精品久久久久久久电影 | 亚洲综合色丁香婷婷六月图片| 亚洲欧美日韩一区二区三区在线观看 | 亚洲午夜黄色| 欧美午夜不卡在线观看免费| 一区二区三区欧美在线观看| 亚洲乱码国产乱码精品精98午夜 | 免费成人黄色| 麻豆freexxxx性91精品| 在线不卡中文字幕| 欧美国产乱视频| 老色鬼精品视频在线观看播放| 中日韩午夜理伦电影免费| 日韩午夜激情av| 国产精品成人一区二区三区夜夜夜 | 一区二区三区四区五区精品视频| 亚洲无毛电影| 国产精品三区www17con| 欧美在线日韩在线| 久久精品视频网| 亚洲国产精品久久久久| 亚洲第一视频| 欧美视频中文字幕| 久久黄色影院| 久久国产毛片| 日韩亚洲精品视频| 99国产精品久久久久老师| 欧美偷拍另类| 久久久久欧美精品| 欧美精品日韩三级| 欧美一区二区啪啪| 美女脱光内衣内裤视频久久网站| 国产欧美va欧美不卡在线| 免费人成网站在线观看欧美高清| 亚洲一区三区在线观看| 樱花yy私人影院亚洲| 亚洲精品久久久久久久久久久久久 | 午夜亚洲影视| 亚洲区国产区| 亚洲男人影院| 亚洲精品小视频| 亚洲永久免费av| 亚洲激情校园春色| 亚洲欧美日韩国产综合在线 | 久久精品一二三区| 日韩午夜av电影| 欧美一区二区啪啪| 亚洲一区不卡| 美女国内精品自产拍在线播放| 国产真实精品久久二三区| 亚洲国产另类精品专区| 国产日韩视频| 亚洲视频国产视频| 亚洲精品偷拍| 欧美在线电影| 亚洲欧美视频在线| 欧美理论电影在线观看| 欧美成人在线免费观看| 国产亚洲精品久久久久婷婷瑜伽| 欧美在线91| 国产精品久久激情| 亚洲国产精品欧美一二99| 精品成人在线视频| 午夜精品福利在线| 亚洲综合导航| 欧美日韩国产片| 亚洲国产成人av好男人在线观看| 一区二区三区精品视频| 久久综合九色综合欧美就去吻 | 久久婷婷国产综合尤物精品 | 一区二区欧美精品| 亚洲精品视频在线观看网站| 久久久久国产精品人|