IMO 1966 LL YUG45

An alphabet consists of n letters. What is the maximal length

IMO 1966 LL YUG45

Origin: YUG

Problem

An alphabet consists of n letters. What is the maximal length of a word, if (i) two neighboring letters in a word are always different, and (ii) no word abab (a ̸= b) can be obtained by omitting letters from the given word?