fork download
  1. process.stdin.resume();
  2. process.stdin.setEncoding('utf8');
  3.  
  4. // your code goes here
  5. var readline = require("readline");
  6.  
  7. function main() {
  8. var rl = readline.createInterface(process.stdin, process.stdout);
  9. var seen = {};
  10. rl.on('line', function (line) {
  11. var words = line.match(/\S+/g) || [];
  12. words.forEach(function(word) {
  13. if (word in seen) return;
  14. seen[word] = true;
  15. console.log(word);
  16. });
  17. });
  18. }
  19. main()
Success #stdin #stdout 0.06s 11184KB
stdin
aaa bbb ccc bbb aaa
ddd ccc eee aaa fff
fff ccc aaa ggg eee
stdout
aaa
bbb
ccc
ddd
eee
fff