[解题报告]483 - Word Scramble
Word Scramble |
Write a program that will reverse the letters in each of a sequence of words while preserving the order of the words themselves.
Input
The input file will consist of several lines of several words. Words are contiguous stretches of printable characters delimited by white space.
Output
The output will consist of the same lines and words as the input file. However, the letters within each word must be reversed.
Sample Input
I love you. You love me. We're a happy family.
Sample Output
I evol .uoy uoY evol .em er'eW a yppah .ylimaf
字符处理倒转,水
#include <stdio.h> #include <string.h> char word[100]; int main() { int i; while(scanf("%s",word)!=EOF) { for(i=strlen(word)-1;i>=0;i--) printf("%c",word[i]); printf("%c",getchar()); } return 0; }