#P2001. ACSL 2015-2016 Junior Division Contest #2 ACSL STRINGS
ACSL 2015-2016 Junior Division Contest #2 ACSL STRINGS
PROBLEM DESCRIPTION
Every computer language has different string functions and many have a different method of finding a substring. For this program you will be asked to code the algorithm that replicates the string function SUBSTR (string, start, length) as defined below:
| Parameter | Description |
|---|---|
| string | Specifies the string on which the function is to be applied |
| start |
|
| length |
|
INPUT FORMAT
There will be lines of input (there are shown here for extra examples). The first line will be a character string of fewer than characters. The remaining lines will each have integers representing the start and length values of the function parameters.
OUTPUT FORMAT
For each set of parameter values, print the substring produced. We guarantee that the first and/or last outputted character will not be a space. We also guarantee that each substring will be valid.
SAMPLE
INPUT #1
Hello world!
0, 10
1, 8
0, 5
6, 6
0, -1
-10, -2
0, -5
-4, 0
OUTPUT #1
Hello worl
ello wor
Hello
world!
Hello world
llo worl
Hello w
rld!