[解题报告]483 - Word Scramble

本文深入探讨了如何使用C语言编写程序来反转单词中的字母顺序,同时保持句子的原始结构不变。通过实例分析,展示了实现这一功能的具体步骤及关键代码片段。

 

 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;
}

 

转载于:https://www.cnblogs.com/TheLaughingMan/archive/2013/02/24/2926728.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值