#include <iostream>
#include <string>
using namespace std;
string toChange (char ch);
int main ()
{
char ss[80];
string s;
while (cin.getline(ss,80))
{
if (ss[0] == '#') break;
for (int i = 0; ss[i] != '\0'; i++)
{
cout<<toChange(ss[i]);
}
cout<<endl;
}
return 0;
}
string toChange (char ch)
{
string s = "";
switch (ch)
{
case ' ': s = "%20"; break;
case '!': s = "%21"; break;
case '$': s = "%24"; break;
case '%': s = "%25"; break;
case '(': s = "%28"; break;
case ')': s = "%29"; break;
case '*': s = "%2a"; break;
default: s += ch;
}
return s;
}
ZOJ Problem Set - 2932 The Seven Percent Solution
最新推荐文章于 2017-12-27 15:16:53 发布