Similar Items: An Erdős--Szekeres type result for words with repeats