It was not trivial to come up with an optimal and elementary O(nm) time algorithm.
Compute the hashes of the nm strings formed by taking each of the n strings and zeroing out one of the m characters. If you get any hash collisions, compare the strings.