11.5. The alphabet consists of $n$ letters. A word composed of these letters is called allowed if all adjacent letters in it are different and it is impossible to obtain a word of the form $a b a b$ by erasing letters from it, where the letters $a$ and $b$ are different. What is the maximum length that an allowed word can have?