You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

20 lines
428 B

  1. #include <stdio.h>
  2. #include <string.h>
  3. int main() {
  4. char s[257], c;
  5. int i = 0;
  6. while ((c = getc(stdin)) != '.') {
  7. if (c == '\n')
  8. break;
  9. s[i++] = c;
  10. }
  11. s[i] = '\0';
  12. // i is already the size of s. I've used strlen to follow the 'hints'
  13. // section.
  14. putc('\"', stdout);
  15. for (i = strlen(s) - 1; i >= 0; --i) {
  16. putc(s[i], stdout);
  17. }
  18. putc('\"', stdout);
  19. }