/ APL / 2021 / 05.apl
05.apl
1  input ← ((⍎¨','(≠⊆⊢)⊢)¨(⊂'->')~⍨' '(≠⊆⊢)⊢)¨⊃⎕NGET '../.cache/2021/5' 1
2  iter ← {a b←⍵⋄a≡b:⊂b⋄(⊂a),∇(a+×b-a) b}
3  ⎕ ← +/2≤≢¨⊢/{⍺ ⍵}⌸⊃,/iter¨{(∨⌿⍉↑=⌿⍉↑⍵)/⍵} input
4  ⎕ ← +/2≤≢¨⊢/{⍺ ⍵}⌸⊃,/iter¨ input