题解 | #字符串反转#
字符串反转
https://www.nowcoder.com/practice/e45e078701ab4e4cb49393ae30f1bb04
#include <stdio.h>
#include<string.h>
int main() {
char s[1000];
while (scanf("%s", s) != EOF) {
int len=strlen(s),left=0,right=len-1;
while(left<=right){
char ch=s[left];
s[left]=s[right];
s[right]=ch;
left++;
right--;
}
printf("%s\n", s);
}
return 0;
}
#华为笔试#

查看12道真题和解析