fork(2) download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. /*string word;
  8. int a,l;
  9.  
  10. cin>>l;
  11.  
  12. for(int i=0; i<l; i++)
  13. {
  14.   cin>>word;
  15.   a=word.length();
  16.  
  17.   for(int i=a; i>=0; i--) cout<<word[i-1];
  18.  
  19. cout<<endl;
  20. }*/
  21. string *word;
  22. int a,*l,k=0;
  23.  
  24. cin>>a;
  25. word=new string[a];
  26. l=new int[a];
  27.  
  28. for(int i=0; i<a; i++)
  29. {
  30. cin>>word[i];
  31. l[i]=word[i].length();
  32. }
  33.  
  34.  
  35. for(int i=0; i<a; i++)
  36. {
  37. for(int i=l[k]; i>=0; i--)
  38. {
  39. cout<<word[k][i-1];
  40. }
  41. k++;
  42. cout<<endl;
  43. }
  44.  
  45.  
  46. return 0;
  47. }
  48.  
Runtime error #stdin #stdout #stderr 0.45s 529920KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc