fork download
  1. let line;
  2.  
  3. while ((line = readline()) !== null) {
  4. const counts = new Map();
  5.  
  6. for (const ch of line) {
  7. counts.set(ch, (counts.get(ch) || 0) + 1);
  8. }
  9.  
  10. let shouldPrint = false;
  11.  
  12. for (const count of counts.values()) {
  13. if (count === 2) {
  14. shouldPrint = true;
  15. break;
  16. }
  17. }
  18.  
  19. if (shouldPrint) {
  20. console.log(line);
  21. }
  22. }
Success #stdin #stdout 0.03s 17032KB
stdin
asdf
fdas
asds
d fm
dfaa
aaaa
aabb
aaabb
stdout
asds
dfaa
aabb
aaabb