I think the best algorithm is to sort first and then check for pairs.
Sorting O(n log n) and then comparing pairs just once O(n) is so much faster than checking all letters against all other letters O(n^2).
This is also clearly shown by the graph from WolframAlpha