fork download
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. string word[6000];
  6. char s[103000];
  7.  
  8. int main()
  9. {
  10. map<string,long> dictionary;
  11. int i,n,len,total_words;
  12. i=0;
  13.  
  14. scanf("%[^EOF]",s);
  15. len=strlen(s);
  16.  
  17. n=0;
  18. for(i=0;i<len;i++)
  19. {
  20. s[i]=tolower(s[i]);
  21.  
  22. if(s[i]>='a' && s[i]<='z')
  23. {
  24. word[n]=word[n]+s[i];
  25. }
  26. if(!(s[i]>='a' && s[i]<='z'))
  27. {
  28. n++;
  29. }
  30. }
  31. total_words=n;
  32.  
  33. sort(word,word+total_words);
  34.  
  35. for(i=0;i<total_words;i++)
  36. {
  37. if(dictionary[word[i]]==0)
  38. {
  39. dictionary[word[i]]++;
  40. if(word[i]=="") continue;
  41. cout<<word[i]<<endl;
  42. }
  43. }
  44. return 0;
  45. }
Success #stdin #stdout 0s 3608KB
stdin
Andy's first Dictionary is ready


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
andy
blondes
came
dictionary
disneyland
first
fork
going
home
in
is
left
read
ready
road
s
sign
so
the
they
to
two
went
were
when