fork download
  1. #include<stdio.h>
  2.  
  3. #include<string.h>
  4.  
  5. #define MAXLINE 50
  6.  
  7. void reverse (char slovo[])
  8.  
  9. {
  10.  
  11. int len = strlen(slovo);
  12.  
  13. char dr_slovo[len];
  14.  
  15. for (int i = 0; i < len; ++i)
  16. {
  17. dr_slovo[len-1-i] = slovo[i];
  18. }
  19. printf ("%s\n", dr_slovo);
  20. }
  21.  
  22. int main()
  23.  
  24. {
  25.  
  26. int slovo;
  27.  
  28. char word[MAXLINE];
  29.  
  30. int i = 0;
  31.  
  32. while(slovo = getchar())
  33.  
  34. {
  35.  
  36. if (slovo == -1)
  37. break;
  38. else if (slovo == '\n')
  39. {
  40. reverse(word);
  41. i = 0;
  42. }
  43. else
  44. {
  45. word[i] = /*putchar*/(slovo);
  46. ++i;
  47. }
  48. }
  49. return 0;
  50.  
  51. }
  52.  
Success #stdin #stdout 0s 5356KB
stdin
abcdefghij
1234
stdout
/�jihgfedcba
/�jihgfe4321