Sponsored
Use these hints if you're stuck. Try solving on your own first.
Two words w1 and w2 are similar if and only if w1 == w2, (w1, w2) was a pair, or (w2, w1) was a pair.
Solve with full IDE support and test cases