openjudge水题 翻转诗句
来源:互联网 发布:js 中文编码 编辑:程序博客网 时间:2024/04/25 12:34
反转诗句
- 查看
- 提交
- 统计
- 提示
- 提问
- 总时间限制:
- 1000ms
- 内存限制:
- 65536kB
- 描述
- 你手中有些从右向左读的诗句,比如“rose red red a like is luve my O”。
现在为了阅读这些美妙的诗句,你要把这些语句反转成正常的从左到右,即“O my luve is like a red red rose”。 - 输入
- 每一行为原来从右向左读的诗句S。该诗句中不包含任何标点符号,单词间以空格隔开。每条诗句最多包含 50个单词,每个单词最多包含50个字符。
- 输出
- 每一行为正常的从左到右读的诗句。
- 样例输入
rose red red a like is luve my OJune in sprung newly That'smelodie the like is luve my Otune in played sweetly That's
- 样例输出
O my luve is like a red red roseThat's newly sprung in JuneO my luve is like the melodie
That's sweetly played in tune
简单的
字符串操作
#include<stdio.h>#include<string.h>int main(){int i,j,k;int flag;char str[100];char word[100][100]; while(gets(str)){ flag=1; j=0; k=0; for(i=0;i<strlen(str);i++){ if(str[i]!=' '&&flag==0){ flag=1;} if(str[i]!=' '&&flag==1){ word[k][j++]=str[i]; } if(str[i]==' '&&flag==1){flag=0;word[k][j++]='\0';j=0;k++;} }word[k][j++]='\0';k++;for(i=k-1;i>0;i--){printf("%s ",word[i]);}printf("%s\n",word[i]);}return 0;}
0 0
- openjudge水题 翻转诗句
- 诗句
- 诗句
- openjudge 水题 方块转换
- OpenJudge
- 诗句充酒茶
- 经典诗句
- 经典诗句
- 经典诗句
- 一些诗句
- 反转诗句
- 诗句摘录
- 凄美诗句
- 浪漫诗句
- 浪漫诗句
- 递归 单词翻转 (Coursera 程序设计与算法 专项课程2 C程序设计进阶 李戈;OpenJudge)
- 矩阵翻转 贪心 水题
- 泰戈尔经典诗句
- 无底色 无背景 logo 图标
- how to remove 1px line at UINavigationBar
- STM32用SysTick来做定时器
- BinarySearch小总结
- openjudge 水题 方块转换
- openjudge水题 翻转诗句
- Task Scheduler I & II
- mybatis-XMLMapperEntityResolver 找对应的dtd文件
- 莫等闲,白了少年头,空悲切
- 【非常高%】【codeforces 733B】Parade
- 【25.47%】【codeforces 733D】Kostya the Sculptor
- #早安,努力#11.01
- 使用注解的spring mvc
- 洛谷P2921/BZOJ1589[USACO08DEC]在农场万圣节Trick or Treat on the Farm