P1061 [NOIP 2006 Junior] Jam's Counting Method

Description

Jam is an eccentric scientist who likes to be unconventional. He does not count with Arabic numerals, but with lowercase English letters. He believes this makes the world more colorful. In his counting system, every number has the same length (uses the same number of letters). The English letters keep their original order, and a letter earlier in the alphabet is smaller than a letter later in the alphabet. We call such “numbers” Jam numbers. In a Jam number, all letters are distinct and strictly increasing from left to right. Each time, Jam also specifies the range of letters to use; for example, from $2\sim 10$ means only the letters ${b,c,d,e,f,g,h,i,j}$ can be used. If the length is further specified to be $5$, then the number immediately following the Jam number $\texttt{bdfij}$ should be $\texttt{bdghi}$ (if we denote the Jam numbers $\texttt{bdfij}$ and $\texttt{bdghi}$ by $U$ and $V$ in order, then $U

Input Format

There are $2$ lines. The first line contains $3$ positive integers $s, t, w$, separated by a space. (Here, $s$ is the index of the smallest letter used, $t$ is the index of the largest letter used, and $w$ is the length of the number. These $3$ numbers satisfy $1\le s

Output Format

Output up to $5$ lines: the next $5$ Jam numbers after the input Jam number in order. If there are fewer than $5$ Jam numbers after it, output as many as exist. Print exactly one Jam number per line, each being a string of $w$ lowercase letters, with no extra spaces.

Explanation/Hint

NOIP 2006 Junior Problem 3. Translated by ChatGPT 5