题目描述:https://pycoder.blog.csdn.net/article/details/124789706
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void) {
char str[200] = {0};
int flag = 0;
gets(str);
char* tmp = NULL;
tmp = strtok(str, " ");
if (tmp == NULL) {
printf("/\n");
return 0;
}
printf("%s", tmp);
if (tmp[strlen(tmp) - 1] == '/') {
flag = 1;
}
tmp = strtok(NULL, " ");
if (tmp == NULL) {
return 0;
}
if (tmp[0] == '/') {
if (flag == 0) {
printf("%s\n", tmp);
} else {
printf("%s\n", tmp + 1);
}
} else {
if (flag == 0) {
printf("/%s\n", tmp);
} else {
printf("%s\n", tmp);
}
}
return 0;
}