fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. char n;
  6. vector<char> a;
  7. while(cin >> n){
  8. a.push_back(n);
  9. }
  10. while(a[a.size()-1] == '0'){
  11. a.pop_back();
  12. }
  13. if(a[a.size()-1] == '.'){
  14. for(int i = 0; i < a.size()-1; i++){
  15. cout << a[i];
  16. }
  17. }
  18. else{
  19. for(int i = 0; i < a.size(); i++){
  20. cout << a[i];
  21. }
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5320KB
stdin
12218221.0000

stdout
12218221