fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. using namespace std;
  5. int n=0;
  6.  
  7. int main()
  8. {
  9. int *x;
  10. x=new int [1];
  11. while(cin>>x[n])
  12. {
  13. n++;
  14. realloc(x,n);
  15. }
  16. for(int i=n-1;i>=0;i--)
  17. {
  18. cout<<x[i]<<" ";
  19. }
  20. delete [] x;
  21. return 0;
  22. }
Success #stdin #stdout 0s 3472KB
stdin
555555 444 333 222 111
stdout
111 223 333 444 555555