UVA-483 Word Scramble Solution

#include <stdio.h>
#include <string.h>
char word[1000];
int main()
{
int c;
int i = 0;
while ((c = getchar()) != EOF)
{

if (c == ' '|| c=='\n' || c=='\t')
{
int len = strlen(word);
while (len-->0)
putchar(word[len]);
i = 0;
word[0] = '\0';
putchar(c);
}
else{
word[i++] = c;
word[i] = '\0';
}

}
return 0;
}

Comments

Popular Posts