#K42732. Typewriter Display Simulation
Typewriter Display Simulation
Typewriter Display Simulation
This problem simulates a typewriter display mechanism. Given a fixed integer N representing the display length and a string S, you are required to simulate the process of gradually displaying the string in a fixed-width display.
At each step, the display will show the most recent characters up to the length N. If the number of characters is less than N, the remaining positions will be filled with dots (.
). Once the length of the shown part exceeds N, only the last N characters of the current window are displayed.
For example, if N = 5 and S = "HELLO", the successive states of the display will be:
H.... HE... HEL.. HELL. HELLO
Note that the simulation begins with an empty display and then gradually adds characters from S one by one.
inputFormat
The input is read from standard input:
- The first line contains a single integer N (1 ≤ N ≤ 105), representing the fixed length of the display.
- The second line contains a non-negative string S consisting of uppercase letters. It represents the sequence of characters to be displayed. If the string is empty, no output should be produced.
outputFormat
Print the simulated display states to standard output. Each state should be printed on its own line. There should be exactly as many lines as the number of characters in S.
## sample5
HELLO
H....
HE...
HEL..
HELL.
HELLO
</p>