Automatic Poetry

来源:互联网 发布:重装系统用什么软件 编辑:程序博客网 时间:2024/05/09 10:16

题目如下:

“Oh God”, Lara Croft exclaims, “it’s one of these dumb riddles again!”

 

In Tomb Raider XIV, Lara is, as ever, gunning her way through ancient Egyptian pyramids, prehistoric caves and medival

hallways. Now she is standing in front of some important Germanic looking doorway and has to solve a linguistic riddle to

pass. As usual, the riddle is not very intellectually challenging.

 

This time, the riddle involves poems containing a “Schuttelreim”. An example of a Schuttelreim is the following short

poem:

 

Ein Kind halt seinen Schnabel nur,

wenn es hangt an der Nabelschnur.        

 

/*German contestants please forgive me. I had to modify something as they were not appearing correctly in plain text

format*/

 

A Schuttelreim seems to be a typical German invention. The funny thing about this strange type of poetry is that if

somebody gives you the first line and the beginning of the second one, you can complete the poem yourself. Well, even a

computer can do that, and your task is to write a program which completes them automatically. This will help Lara

concentrate on the “action” part of Tomb Raider and not on the “intellectual” part.

Input

The input will begin with a line containing a single number n. After this line follow n pairs of lines containing

Schuttelreims. The first line of each pair will be of the form

s1<s2>s3<s4>s5

 

where the si are possibly empty, strings of lowercase characters or blanks. The second line will be a string of lowercase

characters or blanks ending with three dots “...”. Lines will we at most 100 characters long.

Output

For each pair of Schuttelreim lines l1 and l2 you are to output two lines c1 and c2 in the following way: c1 is the same as

l1 only that the bracket marks “<” and “>” are removed. Line c2 is the same as l2 , except that instead of the three

dots the string s4s3s2s5 should appear.


Sample Input

3
ein kind haelt seinen <schn>abel <n>ur
wenn es haengt an der ...
weil wir zu spaet zur <>oma <k>amen
verpassten wir das ...
<d>u <b>ist
...

Sample Output

ein kind haelt seinen schnabel nur

wenn es haengt an der nabel schnur

weil wir zu spaet zur oma kamen

verpassten wir das koma amen

du bist

bu dist

 

 

不知为什么RTE了好多次,然后突然AC了。。。

代码如下:

 

0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 我的手机汽车之家无法看视频怎么办 来事泡温泉细菌感染外阴瘙痒怎么办 西澳大学语言班没通过怎么办 银行入职培训理论考试不合格怎么办 去泰国旅游不会泰语和英语的怎么办 老板不发工资怎么办没签合同的 3d模型导进去材质丢失怎么办 七日杀显示载入中之后进不去怎么办 进京证过期了车在北京怎么办 微信打字时剪切的东西丢了怎么办 错过了医师定期考核报名时间怎么办 大学档案在自己手里放多年怎么办 档案在自己手里10年了怎么办 快递地址区域划分写错了怎么办 怀孕八个月肛门长个肉疙瘩怎么办呢 客户签了合同不要货了怎么办 不喂母乳宝宝只认识保姆了怎么办? 开创者比赛后没有买的鸽子怎么办 买回来小鸽子开家我敢了怎么办 小鸽子出壳后母鸽就不孵了怎么办 狗狗在笼子里一直叫怎么办 养了一年母鸽子不配对怎么办 血管翳云翳斑翳长满眼睛怎么办 鸽子训放50公里突然下雨了怎么办 安卓手机反应慢又卡怎么办 tcl安卓系统电视反应慢怎么办 狼人杀警长竞选一直平票怎么办 去驾校投诉教练被教练报复怎么办 哈尔滨机场大巴六点的飞机怎么办 山东德州恩城镇的农民怎么办养老险 我的世界联机平台房间进不去怎么办 验车时间过了3天怎么办 在携程订的机票和酒店不能退怎么办 千牛工作台中旺旺登录失败怎么办 掌通家园换手机号了忘了更改怎么办 qq注销了后绑定的全民k歌怎么办 小米账号绑定的手机号注销了怎么办 微信账号注销后绑定的手机号怎么办 微信账号不想用了注销不了怎么办 苹果手机掉了捡到不还怎么办 在工作中把和别人结下梁子了怎么办