UVaOJ 10361 - Automatic Poetry
来源:互联网 发布:长沙智工软件 编辑:程序博客网 时间:2024/05/23 15:07
AOAPC I: Beginning Algorithm Contests (Rujia Liu) :: Volume 1. Elementary Problem Solving :: String
Description
输入两行字符串。
(以下 “s1”、“s2”、“s3”、“s4”、“s5”、“s” 表示字符串。)
第一行字符串,形如 “s1<s2>s3<s4>s5”。
第二行字符串,形如 “s...” 。
输出两行字符串。
第一行为 “s1 s2 s3 s4 s5”(字符串间无空格)。
第二行为 “s s4 s3 s2 s5”(字符串间无空格)。
Type
String
Analysis
可以利用头文件<iostream>里面的getline函数,读到 '<' 或 '>' 停止。
例如,从 cin 读取字符串 s1 到 ‘<' 停止,即为 getline(cin, s1, '<')。
然后输出时,调换一下字符串的顺序即可。
Solution
// UVaOJ 10361// Automatic Poetry// by A Code Rabbit#include <cstdio>#include <iostream>using namespace std;string s1, s2, s3, s4, s5;string s;int main() { int tot_case; scanf("%d", &tot_case); getchar(); while (tot_case--) { // Input. getline(cin, s1, '<'); getline(cin, s2, '>'); getline(cin, s3, '<'); getline(cin, s4, '>'); getline(cin, s5); getline(cin, s); // Output. cout << s1 << s2 << s3 << s4 << s5 << endl; s.erase(s.end() - 3, s.end()); cout << s << s4 << s3 << s2 << s5 << endl; } return 0;}
- UvaOJ 10361 - Automatic Poetry
- UVaOJ 10361 - Automatic Poetry
- UVaOJ 10361 - Automatic Poetry
- UVAOJ 10361 ——Automatic Poetry 模拟
- 10361--Automatic Poetry
- 10361 - Automatic Poetry
- 10361 - Automatic Poetry
- uva 10361 Automatic Poetry
- UVa 10361 - Automatic Poetry
- uva 10361 Automatic Poetry
- 10361 - Automatic Poetry
- UVa 10361 - Automatic Poetry
- UVa 10361 - Automatic Poetry
- uva-10361-Automatic Poetry
- 10361 - Automatic Poetry
- UVA 10361Automatic Poetry
- 10361 - Automatic Poetry
- UVA 10361 - Automatic Poetry
- win7安装IIS及将网站发布到IIS上
- C#委托之个人理解(转)
- NullPoint问题,有时候会引起大错误
- jquery的ajax()函数传值中文乱码的解决方案
- iOS 关于音频开发
- UVaOJ 10361 - Automatic Poetry
- 较为简单的一种判断Retina屏幕的方法
- Extjs自定义组件
- C#学习之四---ListBox
- 一个牛人给java初学者的建议
- poj 1903 zoj 2469 la2965(live archive) 中途相遇法
- 编写一个方法,输出在一个字符串中,指定字符串出现的次数
- C#事件(event)解析(转)
- smarty保留变量