#K16181. Staircase Progression

    ID: 24522 Type: Default 1000ms 256MiB

Staircase Progression

Staircase Progression

Given an integer \(n\), generate a staircase progression of numbers. The progression begins at 1, increases by appending the next number on each line until reaching \(n\), then decreases by removing the last digit sequentially until reaching 1 again.

For example, if \(n = 4\), the output should be:

1
12
123
1234
123
12
1

If \(n < 1\), the output is empty.

inputFormat

The input is provided from standard input (stdin) as a single integer \(n\). This number represents the maximum width of the staircase. If \(n < 1\), no output should be produced.

outputFormat

Print the staircase progression to standard output (stdout). Each line should contain a sequence of successive integers starting from 1. The progression first ascends from 1 up to \(n\), and then descends from \(n-1\) back to 1. Ensure that lines are separated by a newline character (\n) with no trailing newline at the end.

## sample
4
1

12 123 1234 123 12 1

</p>