1
0

2810.c 573 B

12345678910111213141516171819202122232425262728293031
  1. //
  2. // Created by 李洋 on 2024/4/3.
  3. //
  4. #include <stdlib.h>
  5. #include <string.h>
  6. void reverse(char *s, int end) {
  7. int i = 0;
  8. while (i < end) {
  9. char temp = s[i];
  10. s[i] = s[end];
  11. s[end] = temp;
  12. i++;
  13. end--;
  14. }
  15. }
  16. char *finalString(char *s) {
  17. int len = strlen(s);
  18. char *r = malloc((len + 1) * sizeof(char));
  19. int x = 0;
  20. for (int i = 0; i < len; i++) {
  21. if (i != 0 && s[i] == 'i') {
  22. reverse(r, x - 1);
  23. } else {
  24. r[x++] = s[i];
  25. }
  26. }
  27. r[x] = '\0';
  28. return r;
  29. }
备用站点 当前处于降级运行的备用站点,仅供应急访问,数据和功能可能不是最新。