Code golf: find all anagrams

后端 未结 8 2021
再見小時候
再見小時候 2021-02-04 06:00

A word is an anagram if the letters in that word can be re-arranged to form a different word.

Task:

  • The shortest source code by character count to find

8条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-04 06:22

    Ruby, 94 characters

    h={};(h[$_.upcase.bytes.sort]||=[])<<$_ while gets&&chomp;h.each{|k,v|puts v.join' 'if v.at 1}
    

提交回复
热议问题