```cpp
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
string st;
int a=-1,b=-1,c=-1,d,ans;
bool cmpp;
int main()
{
cin >>st;
a=st.find(".");
b=st.find("/");
c=st.find("%");
if (a==-1 && b==-1 && c==-1)
{
cmpp=false;
ans=0;
for (int i=st.size()-1;i>=0;i--)
{
if (st[i]=='0' && cmpp==true){
cout <<st[i];ans++;}
if (st[i]!='0'){cout <<st[i];cmpp=true;ans++;}
}
if (ans==0) cout <<0<<endl;
}
if (a!=-1)
{
cmpp=false;
ans=0;
for (int i=a-1;i>=0;i--)
{
if (st[i]=='0' && cmpp==true){
ans++;
cout <<st[i];
}
if (st[i]!='0'){cout <<st[i];ans++;cmpp=true;}
}
if (ans==0) cout <<0;
cout <<".";
ans=0;
for (int i=st.size()-1;i>=a+1;i--)
{
if (st[i]=='0')
{
cmpp=true;
for (int j=i-1;j>=a+1;j--)
{
if (st[j]!='0')
{
cmpp=false;
break;
}
}
if (cmpp==true)
{
d=i;
break;
}
}
}
for (int i=st.size()-1;i>=d+1;i--)
{
cout <<st[i];
ans++;
}
if (ans==0) cout <<ans<<endl;
}
if (b!=-1)
{
cmpp=false;
ans=0;
for (int i=b-1;i>=0;i--)
{
if (st[i]=='0' && cmpp==true){
cout <<st[i];ans++;}
if (st[i]!='0'){cout <<st[i];cmpp=true;ans++;}
}
if (ans==0) cout <<0;
cout <<"/";
for (int i=st.size()-1;i>=b+1;i--)
{
if (st[i]=='0' && cmpp==true)
cout <<st[i];
if (st[i]!='0'){cout <<st[i];cmpp=true;}
}
}
if (c!=-1)
{
cmpp=false;
ans=0;
for (int i=c-1;i>=0;i--)
{
if (st[i]=='0' && cmpp==true){
cout <<st[i];ans++;}
if (st[i]!='0'){cout <<st[i];cmpp=true;ans++;}
}
if (ans==0) cout <<0;
cout <<"%"<<endl;
}
return 0;
}
```
by Lionel_Andres_Messi @ 2019-01-25 17:27:35
希望更丰富的展现?使用Markdown
by Luban @ 2019-01-25 17:37:11
我的代码,AC了,你可以参考下QAQ
#别抄袭哈!棕了我不负责!
```cpp
#include<bits/stdc++.h>
using namespace std;
char s[25];
int main()
{
scanf("%s",s);
int k=strlen(s)-1,a=0,b=0,c=0,d=0,p1=0,p2=0;
if (s[k]=='%')
{
k=k-1;
while(k>=0)
{
if (s[k]!='0') a=1;
if (a==1||s[k]!='0') cout<<s[k];
k=k-1;
}
if (a==0) cout<<0;
cout<<"%";
return 0;
}
k=strlen(s)-1;
while(k>=0)
{
if (s[k]=='.') p1=k;
if (s[k]=='/') p2=k;
k=k-1;
}
if (p1!=0)
{
k=p1-1;
while(k>=0)
{
if (s[k]!='0') b=1;
if (b==1||s[k]!='0') cout<<s[k];
k=k-1;
}
if (b==0) cout<<0;
cout<<".";
k=strlen(s)-1;
p1=p1+1;
while(s[p1]=='0')
{
p1=p1+1;
}
if (p1==strlen(s))
{
cout<<0;
return 0;
}
while(k>=p1)
{
cout<<s[k];
k=k-1;
}
return 0;
}
if (p2!=0)
{
k=p2-1;
while(k>=0)
{
if (s[k]!='0') c=1;
if (c==1||s[k]!='0') cout<<s[k];
k=k-1;
}
if (c==0) cout<<0;
cout<<"/";
k=strlen(s)-1;
c=0;
while(k>p2)
{
if (s[k]!='0') c=1;
if (c==1||s[k]!='0') cout<<s[k];
k=k-1;
}
return 0;
}
k=strlen(s)-1;
while(k>=0)
{
if (s[k]!='0') d=1;
if (d==1||s[k]!='0') cout<<s[k];
k=k-1;
}
if (d==0) cout<<0;
return 0;
}
```
by Luban @ 2019-01-25 17:38:56