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

Yiner的ACM

成長的痕跡
<2011年4月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

統計

  • 隨筆 - 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>
            国产目拍亚洲精品99久久精品| 欧美在线地址| 久久精品国产亚洲aⅴ| 亚洲视频综合| 亚洲欧美国产精品va在线观看 | 影视先锋久久| 在线日本成人| 亚洲日本中文字幕区| 亚洲精品乱码久久久久久黑人| 亚洲人成毛片在线播放女女| 在线视频日本亚洲性| 亚洲综合大片69999| 欧美中文在线视频| 免费成人小视频| 夜夜嗨一区二区三区| 午夜精品久久久久久久99黑人| 久久综合给合久久狠狠色 | 日韩图片一区| 久久都是精品| 欧美日韩精品欧美日韩精品一 | 欧美偷拍另类| 国产一区久久| 一本久久青青| 久久久免费观看视频| 亚洲激情女人| 香蕉久久国产| 欧美日韩视频在线一区二区观看视频 | 欧美成人精品激情在线观看| 国产精品久久久久久福利一牛影视| 国产亚洲精品美女| 一本色道久久综合亚洲精品小说 | 99精品国产热久久91蜜凸| 久久久久久久一区二区三区| 欧美成人免费网站| 亚洲一区二区三区午夜| 欧美成在线观看| 永久久久久久| 午夜视频一区二区| 亚洲精品视频在线播放| 久久久久久久999| 国产精品丝袜久久久久久app| 亚洲精品国偷自产在线99热| 久久午夜影视| 午夜视频在线观看一区二区三区 | 亚洲国产成人精品女人久久久 | 国产欧美一区二区三区国产幕精品 | 欧美一区二区三区四区在线观看地址| 亚洲国产成人一区| 久久精品中文字幕一区| 国产伦精品一区二区三区免费迷| 一本色道久久综合亚洲精品婷婷| 欧美本精品男人aⅴ天堂| 久久se精品一区精品二区| 国产精品一区二区男女羞羞无遮挡| 日韩一区二区免费高清| 亚洲国产人成综合网站| 蜜臀av一级做a爰片久久| 亚洲第一精品影视| 免费成人在线视频网站| 久久精品一级爱片| 国产又爽又黄的激情精品视频 | 欧美大学生性色视频| 亚洲电影中文字幕| 免费观看亚洲视频大全| 久久国产一区二区| 一区二区三区无毛| 欧美成人免费va影院高清| 久久免费99精品久久久久久| 尤物在线观看一区| 欧美成人免费网| 欧美国产专区| 亚洲性夜色噜噜噜7777| 一区二区三区|亚洲午夜| 国产精品swag| 亚洲欧洲在线观看| 亚洲高清在线精品| 亚洲国产精品成人一区二区| 欧美电影免费观看大全| 一区二区三区视频观看| 在线视频欧美精品| 国产手机视频精品| 欧美1区视频| 欧美日韩妖精视频| 欧美亚洲视频一区二区| 欧美在线高清| 日韩天天综合| 午夜激情综合网| 在线观看av一区| 亚洲蜜桃精久久久久久久| 国产伦精品一区二区三区四区免费| 久久久人人人| 欧美日韩小视频| 久久久久久欧美| 欧美精品在线观看| 久久久成人网| 欧美日韩免费高清| 久久久噜噜噜久噜久久| 欧美日韩精品在线观看| 久久深夜福利免费观看| 欧美精品一区二区三区一线天视频| 欧美一区二区在线| 欧美激情a∨在线视频播放| 欧美在线观看视频在线| 欧美成人一区在线| 久久青草久久| 国产欧美精品一区二区三区介绍 | 久久天堂av综合合色| 欧美精品日韩综合在线| 久久精品国产亚洲高清剧情介绍| 欧美韩日视频| 免费久久久一本精品久久区| 国产精品视频不卡| 亚洲三级网站| 最近看过的日韩成人| 亚洲综合社区| 这里只有精品丝袜| 欧美国产一区视频在线观看| 久久久亚洲综合| 国产精品一区二区黑丝| 亚洲精品影视| 亚洲精品久久久一区二区三区| 欧美一区2区视频在线观看| 亚洲少妇最新在线视频| 欧美暴力喷水在线| 欧美国产先锋| 最新成人av在线| 久久影院午夜论| 欧美成人精品影院| 精品91在线| 性色av香蕉一区二区| 性久久久久久| 欧美三日本三级少妇三2023| 99国产精品久久久久老师| 亚洲人体大胆视频| 麻豆免费精品视频| 麻豆精品在线播放| 在线日韩av片| 免费欧美日韩| 亚洲国产精品va在线观看黑人| 国产欧美日韩三级| 亚洲天堂激情| 欧美丝袜一区二区| 99国产精品久久久久久久久久| 一区二区三区高清在线观看| 欧美精品久久一区二区| 99视频日韩| 午夜亚洲精品| 国产一区二区三区四区老人| 欧美一区在线看| 狼人社综合社区| 亚洲国产欧美日韩另类综合| 男人插女人欧美| 亚洲欧洲中文日韩久久av乱码| 99视频精品在线| 国产精品久久久久久久电影| 亚洲一区激情| 久久综合激情| 亚洲精品一区久久久久久| 欧美日韩在线大尺度| 亚洲永久精品大片| 欧美91精品| 宅男噜噜噜66国产日韩在线观看| 国产精品麻豆成人av电影艾秋| 欧美亚洲一区| 欧美成人dvd在线视频| 一片黄亚洲嫩模| 国产亚洲制服色| 欧美激情一区二区久久久| 在线综合亚洲| 麻豆免费精品视频| 这里只有精品视频| 韩国av一区二区三区在线观看| 男人的天堂亚洲| 亚洲综合导航| 亚洲国产裸拍裸体视频在线观看乱了中文 | 99成人免费视频| 久久精品国产综合精品| 亚洲激情亚洲| 国产伦精品一区二区三区高清版| 久久九九热re6这里有精品| 亚洲精品麻豆| 久久先锋影音av| 亚洲综合999| 亚洲国产综合91精品麻豆| 国产精品视频网| 欧美美女bb生活片| 久久久久久久久久久久久女国产乱 | 欧美在线免费一级片| 亚洲日本va午夜在线电影| 国产欧美视频一区二区三区| 欧美精品一区视频| 免费欧美在线视频| 欧美亚洲网站| 亚洲午夜精品久久| 亚洲黄网站黄| 亚洲第一综合天堂另类专| 久久亚洲国产成人| 久久精品亚洲国产奇米99| 亚洲欧美日韩成人| 一区二区欧美日韩|