If the first letters are the same, then the second letters are compared, and so on, until the order is decided . ( If one string runs out of letters to compare, then it is deemed to come first; for example, " cart " comes before " carthorse " . ) The result of arranging a set of strings in alphabetical order is that words with the same first letter are grouped together, and within such a group words with the same first two letters are grouped together, and so on.