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

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>
            麻豆国产精品va在线观看不卡| 亚洲精品国精品久久99热一| 老巨人导航500精品| 性欧美xxxx视频在线观看| 亚洲综合精品一区二区| 香蕉久久a毛片| 久久精品综合| 欧美伦理影院| 国产欧美欧洲在线观看| 永久555www成人免费| 亚洲欧洲日产国码二区| 制服诱惑一区二区| 久久精品官网| 亚洲日本成人| 亚洲午夜激情免费视频| 久久精品亚洲精品| 久久婷婷av| 夜色激情一区二区| 久久精品国产综合精品| 欧美精品久久久久久| 国产精品社区| 亚洲激情av在线| 久久av老司机精品网站导航| 欧美激情导航| 欧美一区二区在线免费播放| 欧美伦理在线观看| 亚洲国产成人在线| 欧美一级夜夜爽| 日韩亚洲精品视频| 久久综合999| 国产一区二区在线观看免费| 一本色道久久88综合亚洲精品ⅰ| 久久久精品999| 99riav国产精品| 欧美成人免费全部| 极品中文字幕一区| 午夜一区二区三区在线观看| 最近中文字幕日韩精品| 久久久精彩视频| 国产欧美精品一区aⅴ影院| 宅男精品导航| 亚洲精品网站在线播放gif| 另类激情亚洲| 在线观看日韩av电影| 久久久精品久久久久| 亚洲一区二区三区乱码aⅴ| 欧美精品在线极品| 在线日韩精品视频| 久久精品亚洲一区二区| 亚洲一区在线观看视频| 欧美日韩一区国产| 夜夜爽夜夜爽精品视频| 亚洲二区三区四区| 久久综合网色—综合色88| 激情综合色综合久久| 久久成人一区二区| 午夜日韩在线观看| 国产日产高清欧美一区二区三区| 亚洲综合视频一区| 亚洲自拍偷拍麻豆| 国产日韩欧美一区| 久久亚洲精选| 美女黄色成人网| 99国产精品久久久| 中文精品在线| 国产欧美三级| 久久婷婷人人澡人人喊人人爽| 欧美中文字幕视频| 在线观看国产精品淫| 欧美成人在线免费视频| 欧美激情久久久久| 亚洲午夜精品一区二区| 亚洲欧美不卡| 在线欧美日韩精品| 亚洲精品乱码久久久久久日本蜜臀| 欧美国产精品中文字幕| 欧美视频在线观看免费网址| 亚洲午夜一二三区视频| 香蕉av福利精品导航| 依依成人综合视频| 亚洲欧洲日本一区二区三区| 欧美日本一区二区视频在线观看| 亚洲图片你懂的| 午夜精品久久| 亚洲日本国产| 亚洲一品av免费观看| 国内揄拍国内精品久久| 91久久极品少妇xxxxⅹ软件| 国产精品久久久久久模特 | 国产一区二区精品在线观看| 久久这里只有| 欧美日韩国产精品成人| 久久激情视频免费观看| 欧美ed2k| 久久aⅴ国产紧身牛仔裤| 美女免费视频一区| 亚洲欧美成人| 女人色偷偷aa久久天堂| 欧美亚洲网站| 欧美老女人xx| 免费久久99精品国产| 欧美视频二区| 亚洲电影av在线| 国产三级精品在线不卡| 亚洲精品社区| 亚洲国产电影| 性欧美暴力猛交69hd| 亚洲一区二区3| 欧美aa在线视频| 免费欧美在线| 国产一区亚洲| 午夜欧美大片免费观看| 亚洲欧美日韩精品一区二区| 欧美激情一级片一区二区| 久久午夜视频| 国产午夜精品久久久久久免费视| 宅男噜噜噜66一区二区66| 日韩午夜在线电影| 久久久另类综合| 欧美一区二区视频在线| 欧美日本韩国一区| 最新热久久免费视频| 亚洲高清一二三区| 久久亚洲美女| 欧美成人精品在线观看| 国产精品一区久久久| 一区二区三区视频在线| 99热在线精品观看| 欧美精品在线网站| 91久久精品国产91久久性色| 亚洲黄一区二区| 蜜臀久久99精品久久久画质超高清| 久久午夜羞羞影院免费观看| 激情丁香综合| 美女精品自拍一二三四| 亚洲国产一区在线| 亚洲精品久久视频| 欧美激情视频免费观看| 亚洲日本在线观看| 中文一区二区| 国产嫩草一区二区三区在线观看| 久久精品一本久久99精品| 国产精品视频福利| 欧美一区1区三区3区公司| 久久精品免费观看| 精品999久久久| 欧美精品观看| 亚洲综合999| 久久男女视频| 亚洲国产欧美精品| 欧美欧美天天天天操| 在线一区二区三区做爰视频网站| 欧美一级午夜免费电影| 亚洲电影第三页| 欧美日韩四区| 午夜精品视频网站| 免费亚洲电影在线| 亚洲一卡久久| 在线观看亚洲精品| 欧美日韩一区二区免费在线观看| 一区二区三区欧美激情| 久久亚洲综合网| 亚洲美女区一区| 国产日韩一区| 欧美福利影院| 欧美一区二视频| 亚洲精品在线三区| 久久国产精品99精品国产| 最近中文字幕mv在线一区二区三区四区 | 久久精品99| 亚洲精品日韩在线观看| 国产精品一区二区久久| 免费在线观看精品| 亚洲一卡久久| 亚洲激情av| 久久资源在线| 午夜日韩激情| 亚洲毛片网站| 在线播放日韩| 国产欧美日韩精品在线| 欧美韩日视频| 久久久久网站| 亚洲欧美伊人| 日韩视频在线播放| 欧美国产精品中文字幕| 欧美一区二区三区日韩视频| 91久久久亚洲精品| 狠狠色狠狠色综合系列| 欧美三级视频在线播放| 免费成人性网站| 欧美中文字幕在线播放| 亚洲午夜黄色| 中文国产亚洲喷潮| 亚洲另类黄色| 最新国产の精品合集bt伙计| 欧美激情亚洲视频| 欧美成人乱码一区二区三区| 久久综合伊人77777麻豆| 久久成人免费| 久久黄色影院|