Skip to content

Instantly share code, notes, and snippets.

@pinglunliao
Last active November 5, 2019 08:36
Show Gist options
  • Save pinglunliao/68d2400ac902bfb501f4 to your computer and use it in GitHub Desktop.
Save pinglunliao/68d2400ac902bfb501f4 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
string s;
while(cin >> s)
{
short len = s.length();
bool hasZero = true;
for(short i = len - 1; i >= 0; i--)
{
if( s[i] != '0' )
{
hasZero = false;
}
if( !hasZero )
cout << s[i];
}
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment