fork download
  1. program ideone;
  2. var
  3. s: string;
  4. i, l, r: integer;
  5. begin
  6. readln(s);
  7.  
  8. r:=length(s);
  9. while((r>1) and (s[r]='0')) do r:=r-1;
  10.  
  11. l:=1;
  12. while((l<r) and (s[l]='0')) do l:=l+1;
  13.  
  14. for i:=r downto l do write(s[i]);
  15. writeln();
  16. end.
Success #stdin #stdout 0s 276KB
stdin
123456789
stdout
987654321