fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. #define MAX_LINE 10
  5. char line[MAX_LINE];
  6.  
  7. while ((fgets(line, MAX_LINE, stdin)) != NULL)
  8. {
  9. int i = 0;
  10. //*(strchr(line, '\n')) = '\0';
  11. char* ptr = strchr(line, '\n');
  12. if (ptr) {
  13. *ptr = '\0';
  14. }
  15.  
  16. while (line[i] != '\0')
  17. {
  18. fprintf(stdout, "%c", line[i]);
  19. i++;
  20. }
  21. }
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 2056KB
stdin
123456
123456
stdout
123456123456