Problem I

Automatic Poetry

Input: standard input

Output: standard output

Time Limit: 2 seconds

Memory Limit: 32 MB

“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

又是水题。。。

知道题意后非常容易,一次过。

一读入就输出,第一行用< >分段录入数组,第二行读到“.”后排序输出。

代码如下:

#include<stdio.h>
#include<string.h>int main()
{int n, i;char ch[4][100], temp;scanf("%d", &n);getchar();while (n --){for (i = 0; i < 4; i ++)memset(ch[i], 0, sizeof(ch[i]));for (i = 0; (temp = getchar()) != '<'; i ++)putchar(temp);for (i = 0; (temp = getchar()) != '>'; i ++){putchar(temp);ch[0][i] = temp;}for (i = 0; (temp = getchar()) != '<'; i ++){putchar(temp);ch[1][i] = temp;}for (i = 0; (temp = getchar()) != '>'; i ++){putchar(temp);ch[2][i] = temp;}for (i = 0; (temp = getchar()) != '\n'; i ++){putchar(temp);ch[3][i] = temp;}putchar('\n');for (i = 0; (temp = getchar()) != '.'; i ++)putchar(temp);while ((temp = getchar()) != '\n');printf("%s%s%s%s\n", ch[2], ch[1], ch[0], ch[3]);}return 0;
}

字符串系列——uva10361 - 自动作诗机相关推荐

  1. 【字符串系列】字符串匹配中的位并行算法

    [字符串系列]字符串匹配中的位并行算法 最近一段时间看了一点"柔性字符串匹配", 发现位并行算法在字符串匹配这个领域还是很有用的, 下面抒发一下鄙见. 首先, 字符串位并行算法在a ...

  2. 七十二、Python | Leetcode字符串系列(下篇)

    @Author:Runsen @Date:2020/7/3 人生最重要的不是所站的位置,而是内心所朝的方向.只要我在每篇博文中写得自己体会,修炼身心:在每天的不断重复学习中,耐住寂寞,练就真功,不畏艰 ...

  3. 七十一、Python | Leetcode字符串系列(上篇)

    @Author:Runsen @Date:2020/7/3 人生最重要的不是所站的位置,而是内心所朝的方向.只要我在每篇博文中写得自己体会,修炼身心:在每天的不断重复学习中,耐住寂寞,练就真功,不畏艰 ...

  4. Python 字符串系列三字符串的拼接拆分和判断【简单易懂,代码可以直接运行,强烈推荐】

    Python 字符串系列三字符串的拼接拆分和判断[简单易懂,代码可以直接运行,强烈推荐] ''' 字符串的拼接和拆分 #拆分和拼接 在''中\是转义字符,只有\才表示一个 ''' #以文件路径为例 p ...

  5. 【Python】利用字符串切片输出回文诗

    文章目录 什么是切片 示例 利用字符串切片输出回文诗 案例一 苏东坡和诗 案例二 <四时山水诗> 什么是切片 切片是指对操作的对象截取其中一部分的操作.字符串.列表.元组都支持切片操作. ...

  6. 世界是平的、写诗机、模版式个性化和印客通

    最近在看一本很火爆的新书<世界是平的(第二版)> 在这本书中,提到了十种碾平世界的力量. 老实说,这里的有些标题,的确是不好理解. 1.1989年11月9日,创新时代来临:柏林墙的倒塌和W ...

  7. ROS系列——如何在ros多机系统中使用多个Velodyne VLP16

    ROS系列--如何在ros多机系统中使用多个Velodyne VLP16 说明 修改launch文件 关键点 说明 本文主要介绍ROS多机系统中如何使用多个VLP16,比如A上配备了一个VLP16,B ...

  8. Crackme006 - 全新160个CrackMe学习系列(图文|视频|注册机源码)

    知乎:逆向驿站 原文链接 CrackMe006 | 难度适中适合练手 |160个CrackMe深度解析(图文+视频+注册机源码) crackme006,依然是delphi的,而且没壳子,条线比较清晰, ...

  9. Crackme006 - 全新160个CrackMe深度解析系列(图文+视频+注册机源码)

    原文链接 CrackMe006 | 难度适中适合练手 |160个CrackMe深度解析(图文+视频+注册机源码) crackme006,依然是delphi的,而且没壳子,条线比较清晰,算法也不难,非常 ...

  10. APP自动化测试系列之adb连接真机和模拟器

    VOL 160 21 2020-09 今天距2021年101天 这是ITester软件测试小栈第160次推文 点击上方蓝字"ITester软件测试小栈"关注我,每周一.三.五早上  ...

最新文章

  1. 【力扣网练习题】回文数
  2. java使用线程求素数和1000个0~0.9随机数_求素数(多线程练习题)
  3. js 移动端 滑块验证码插件_VUE技术详解,Vue.js从入门到精通
  4. Ubuntu16.04 UltraEdit 安装破解使用
  5. linux过滤文件的关键字,linux tail 过滤日志文件中的关键字
  6. LETTers比赛第三场 --1002 Ignatius and the Princess III解题报告
  7. Sourse Insight使用过程中的常使用功能简介
  8. 如何全局使用php composer,php – 如何配置要全局安装的composer包?
  9. Eclipse反编译jad插件安装
  10. 为什么老实人很难当上领导?因为他们身上有这个致命弱点
  11. 2019最新高级JAVA架构师之路(价值3万元的教程-年薪百万计划)
  12. linux命令mysql启动,linux中mysql启动服务命令
  13. 新会计准则与旧版内容的不同比较
  14. 项目工时估算PERT法
  15. 华为手机解析出现问题
  16. 蒟蒻の算法题(~~完全不会~~的期望)01
  17. 如何在FreePBX ISO 中文版本安装讯时网关,潮流16FXS 网关和潮流话机
  18. 股票买卖接口源码分享
  19. DataTable数据过滤方法
  20. 最全数学各个分支简介

热门文章

  1. 计算机软件429修复工具,运行时错误 429,ActiveX部件不能创建对象的解决方法小结...
  2. java ssh详解_JAVA SSH 框架介绍
  3. Android Studio在线自动升级版本
  4. 计算机学win7画图,利用windows画图工具新功能,制作简易3D画图很简单了!-win7画图工具...
  5. 联想Y450 GT130M显卡 使用NVIDIA公版驱动(安装成功)
  6. 新人进群发邮件软件,QQ群潜伏发邮件软件,一进群就收到邮件软件
  7. 「数字电路系列」博文目录,学习总结
  8. SOC厂商--全志瑞芯微
  9. pdfFactory Pro的打印首选项设置
  10. TrustedInstaller权限的问题