data/problems/158.yml
---
:id: 158
:name: Exploring strings for which only one character comes lexicographically after
its neighbour to the left
:url: https://projecteuler.net/problem=158
:content: "Taking three different letters from the 26 letters of the alphabet, character
strings of length three can be formed. \nExamples are 'abc', 'hat' and 'zyx'. \nWhen
we study these three examples we see that for 'abc' two characters come lexicographically
after its neighbour to the left. \n For 'hat' there is exactly one character that
comes lexicographically after its neighbour to the left. For 'zyx' there are zero
characters that come lexicographically after its neighbour to the left. \nIn all
there are 10400 strings of length 3 for which exactly one character comes lexicographically
after its neighbour to the left.\n\nWe now consider strings of <var>n</var> ≤ 26
different characters from the alphabet. \n For every <var>n</var>, p(<var>n</var>)
is the number of strings of length <var>n</var> for which exactly one character
comes lexicographically after its neighbour to the left.\n\nWhat is the maximum
value of p(<var>n</var>)?\n\n"