fork(1) download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6. int len, i, j,c=0;
  7. char txt[202], word[5002][202], temp[202];
  8. while(scanf("%s",&txt)!=EOF)
  9. {
  10. len=strlen(txt);
  11. j=0;
  12. for(i=0;i<len;i++)
  13. {
  14. if(txt[i]>='a' && txt[i]<='z')
  15. temp[j++]=txt[i];
  16. else if(txt[i]>='A' && txt[i]<='Z')
  17. temp[j++]=txt[i]-'A'+'a';
  18. }
  19. temp[j]='\0';
  20. if(strlen(temp)>0)
  21. {
  22. strcpy(word[c], temp);
  23. c++;
  24. }
  25. }
  26. for(i=0;i<c;i++)
  27. {
  28. for(j=0;j<c-1;j++)
  29. {
  30. if(strcmp(word[j], word[j+1])>0)
  31. {
  32. strcpy(temp, word[j]);
  33. strcpy(word[j], word[j+1]);
  34. strcpy(word[j+1], temp);
  35.  
  36. }
  37. }
  38. }
  39. for(i=0;i<c;i++)
  40. puts(word[i]);
  41. return 0;
  42. }
Success #stdin #stdout 0s 4208KB
stdin
Adventures in Disneyland

Two blondes were going to Disneyland when they came to a fork in the
road. The sign read: "Disneyland Left."

So they went home.
stdout
a
adventures
blondes
came
disneyland
disneyland
disneyland
fork
going
home
in
in
left
read
road
sign
so
the
the
they
they
to
to
two
went
were
when