P18024 [GCPC 2026] Lyrical Leisure

Description

Hannah's favourite leisure activity is to write poems. She particularly likes to write about the small things in everyday life and about neat patterns. For example, she enjoys to write poems utilizing palindromes, since her name is also one! A palindrome is a string which is equal to its reverse, ignoring the letter cases. However, she would like to introduce a small twist. In the grocery store, she was in the fruit section. When she was about to take a banana, she realized the word consists of the letter ‘`b`’, followed by the palindrome ‘`anana`’ of length 5. Her whole life, she has played around with palindromes, but never with words containing them. At home, she immediately started to think of interesting words containing palindromes. Given two lengths $n$ and $k$, she would like to find a method that constructs a string of length $n$, whose longest palindromic substring is of length $k$. A substring of a string $s$ is a sequence of consecutive characters of $s$. For now, she does not care about whether the string this method provides is an actual word in the dictionary, and any string will suffice.

Input Format

The input consists of: - One line with two integers $n$ and $k$ ($1\leq k\leq n\leq 5000$), the length of the string and the length of the longest palindromic substring.

Output Format

Output a string of length $n$ consisting of English letters (`a`-`z` and `A`-`Z`) whose longest palindromic substring is of length $k$. If there are multiple valid solutions, you may output any one of them.