Official algorithmic problem description and constraints.
You are given an integer π.
Your task is to build a string of uppercase Latin letters. There must be exactly π special characters in this string. Let's call a character special if it is equal to exactly one of its neighbors.
For example, there are 6 special characters in the AAABAACC string (at positions: 1, 3, 5, 6, 7 and 8).
Print any suitable string or report that there is no such string.
Detailed video explanations, mathematical intuition, and clean C++ implementation code.