PAT B1009.说反话
来源:互联网 发布:乐清人民法院淘宝拍卖 编辑:程序博客网 时间:2024/05/21 04:22
给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。
输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过80的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用1个空格分开,输入保证句子末尾没有多余的空格。
输出格式:每个测试用例的输出占一行,输出倒序后的句子。
输入样例:Hello World Here I Come输出样例:
Come I Here World Hello题解
#include<cstdio>#include<iostream>#include<vector>#include<string>using namespace std;int main() {string temp;vector<string> a;while (cin >> temp)a.push_back(temp);vector<string>::iterator it = a.end() - 1;for (; it != a.begin(); it--)cout << *it<<" ";cout << *a.begin();return 0;}//本题用vector和string配合,代码量炒鸡短有没有
阅读全文
0 0
- PAT B1009.说反话
- PAT B1009.说反话
- PAT---B1009. 说反话 (20)
- PAT乙级练习题B1009. 说反话
- B1009. 说反话 (20)
- B1009. 说反话 (20')
- PAT B1009 说反话 关于scanf和其返回值EOF的应用
- 1009 说反话 pat
- PAT 1009. 说反话
- PAT 1009. 说反话
- PAT 1009 说反话
- 1009 说反话 PAT
- PAT-1009 说反话
- 1009,说反话,PAT
- PAT 乙级 说反话
- PAT 1009 说反话
- PAT 1009 说反话
- PAT 1009. 说反话
- 如何取消选择easyui-combogrid的下拉数据
- maven使用TestNG
- 错排列
- map()和reduce()的细节
- CodeForces 299 C.Weird Game(博弈论)
- PAT B1009.说反话
- SQL Server监控
- java菜鸟之路
- 《TP5.0学习笔记---URL和路由篇》
- 大数据--一致性哈希算法
- SVG动态生成的子元素,同时绑定"click"和"dblclick".
- spring 整合 redis,以及spring的RedisTemplate如何使用
- golang中使用go时出现的的问题
- new/delete与malloc/free的区别是什么