#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main()
{
char str[1000010];
const int L = 1000009;
int len;
int index;
while(gets(str)!=NULL)
{
len = strlen(str);
index = L;
while(len >= 0)
{
if(str[len]!=' ')
str[index--] = str[len--];
else
{
str[index--] = '0';
str[index--] = '2';
str[index--] = '%';
len--;
}
}
printf("%s\n",str+index+1);
}
return 0;
}
online_judge_1510
最新推荐文章于 2020-03-04 17:29:00 发布
本文介绍了一种使用 C++ 实现的字符串逆序及特定字符替换的方法。该程序可以将输入的字符串进行逆序,并将空格替换为特定的字符串“%20”。通过此方法,可以有效地处理 URL 编码等场景中的空格问题。

2520

被折叠的 条评论
为什么被折叠?



