Responsive Ads Here

Monday, November 24, 2014

483 - Word Scramble

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>
int main()
{
    char s[100],c;
   while(scanf("%s",s)!=EOF)
   {
        c=getchar();
        int l,i,k;
        l=strlen(s);
        for(i=l-1;i>=0;i--)
        {
            printf("%c",s[i]);
        }
        putchar(c);
   }
    return 0;
}

 


 


 


483 - Word Scramble UVA LINK

No comments:

Post a Comment

php4

<?php    // Start the session  session_start();  ?>  <!DOCTYPE html>  <html>  <head>       <link rel=&q...