以下是使用 C 语言解决此问题的代码: ```c #include <stdio.h> #include <string.h> #include <ctype.h> void reverseWord(char *word) { int len = strlen(word); for (int i = 0; i < len / 2; i++) { char temp = word[i]; word[i] = word[len - i - 1]; word[len - i - 1] = temp; } } void processWord(char *word) { if (isdigit(word[0])) { reverseWord(word); } else if (islower(word[0])) { for (int i = 0; i < strlen(word); i++) { word[i] = toupper(word[i]); } } else if (isupper(word[0])) { for (int i = 0; i < strlen(word); i++) { word[i] = tolower(word[i]); } } } int main() { char sentence[10000]; fgets(sentence, sizeof(sentence), stdin); char *token = strtok(sentence, " "); char result[10000] = ""; while (token!= NULL) { processWord(token); strcat(result, token); strcat(result, " "); token = strtok(NULL, " "); } int len = strlen(result); if (len > 0) { result[len - 1] = '\0'; } printf("%s\n", result); return 0; } ``` [2024-11-11 16:45:21 | AI写代码神器 | 393点数解答]