Last Word
시간 제한: 1000ms메모리 제한: 512MB출처: UKIEPC 2018BOJ 17576
문제
The substring() function is a commonly-used operation available in most programming languages that operates on strings. A start offset and a length are provided and used to construct a new string containing only the characters in a sequence of that length beginning from the offset.
One particular string has had this called a large number of times in sequence: we repeatedly used the standard library function substring(s, start, length) to chop it up until now a potentially much shorter string remains.
Find the value of the string produced by all of these operations.
입력
- The first line of input contains the string s (1 ≤ |s| ≤ 106).
- The second line of input contains the number of operations, n (1 ≤ n ≤ 106).
- Each of the following n lines contains the two integers starti and lengthi (0 ≤ starti < lengthi−1; 1 ≤ starti + lengthi ≤ lengthi−1).
출력
Output the string after all of the successive substring() operations.
예제
예제 1
입력
helloworld 2 1 9 0 5
출력
ellow
예제 2
입력
abcdefghijklmnopqrstuvwxyz 8 1 24 1 22 1 20 1 18 1 16 1 14 1 12 1 10
출력
ijklmnopqr
코드를 제출하려면 로그인하세요.