fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void reverse(const char string[], char out[]) {
  5. int i = 0;
  6. int j = strlen(string);
  7. out[strlen(string)] = '\0';
  8.  
  9. while (j != 0) {
  10. out[i] = string[j - 1];
  11. i++;
  12. j--;
  13. }
  14. }
  15.  
  16. // Rozmiar maksymalnej linijki.
  17. #define BUFFER_SIZE 2048
  18.  
  19. int main(void) {
  20. char input[BUFFER_SIZE];
  21. char output[BUFFER_SIZE];
  22. fgets(input, BUFFER_SIZE, stdin);
  23. reverse(input, output);
  24. puts(output);
  25. return 0;
  26. }
Success #stdin #stdout 0s 2296KB
stdin
Godzio ma pralke.
stdout
.eklarp am oizdoG