Determine the character at position after repeatedly applying a simple string-growth rule.
You are given an initial string and a rule that grows the string in discrete rounds. In each round, the current string is transformed by appending a derived copy of itself according to the game rules.
Your task is to return the character that appears at 1-indexed position after the game has been played for enough rounds to make that position exist.
The exact transformation is simple enough that the answer can be reasoned about without building the entire final string.
You may assume the requested position is valid for the generated string.
Example 1
Input
k = 5
Output
b
Explanation
Using the game's deterministic growth rule, the character at position 5 can be traced back to the source segment and is 'b'.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.