#include<iostream> #include<string> using namespace std; int main() { string s; char p=0; //放符号。 int cnt=0; cin>>s; for(int i=0;i<s.size();i++) { if(s[i]>='0'&&s[i]<='9') cnt++; else { P = S [I]; BREAK ; } } int X = CNT; // X is the number of symbols in front of the (any) cnt-- ; the while (S [CNT] == ' 0 ' && CNT> 0 ) / / 0 to remove the last of the foregoing figures, the leading zeros such that no flip. CNT - ; for ( int I = CNT; I> = 0 ; i-- ) COUT << S [I]; IF (P == 0 ) // were treated unsigned%, other symbols. return 0 ; the else { IF (P == ' % ' ) { COUT << P; return 0 ; } the else COUT << P; } int m = s.size () - . 1 ; the while (S [X + . 1 ] == ' 0 ' && x <M- . 1 ) // 0 that x is not between the two ends to m, so that the number does not appear behind the leading zero flip. the X- ++ ; // note that here the subscript relationship and numerical order. the while (S [m] == ' 0 ' && m> + X1) m--; for(int i=m;i>x;i--) cout<<s[i]; return 0; }