【题目描述】
【输入】
【输出】
【输入样例】
hello world
【输出样例】
#include<iostream> #include<cstdio> #include<cstring> using namespace std; char st[505]; int n,p=0; int main(){ cin.getline(st,sizeof(st));//字符串中含空格 n=strlen(st); st[n]=' ';//串尾追一个空格,方便程序设计 for(int i=0;i<=n;++i){ if(st[i]!=' ') p++; else{ for(int j=i-1;j>=i-p;--j)cout<<st[j]; cout<<st[i]; p=0; } } return 0; }//OK
Powered by 孙会中 @ 2024-2026【 www.sunhuizhong.cn 】All rights reserved
访问统计:386183 本月:281 上月:799 今日:7 昨日:6 当前在线:1人