Do not compare every string to every other string (). Connect every string to its letters!
Nodes are strings. Nodes are letters (a-z).
For each string, union it with each of its letters. Strings sharing a letter become connected through that letter hub.
Finally, count distinct leaders among strings only. Time: where is average string length.
Space complexity is for the data structures used.