#Lutece0524. 取任意子串

取任意子串

Migrated from Lutece 524 取任意子串

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

小Q在课堂听了老师讲指针与字符串的关系,他很快就写了一个求字符串任意子串的函数。聪明的你,不利用库函数也能很快做到吗?

Input

第一行是一个长度不超过100100的字符串。第二行是一个正整数nn表示测试数据的组数。下面每一行有两个整数,用空格隔开,表示子串在字符串中的起始位置和取的长度。

Output

每组数据对应有一行子串输出。

Samples

abcdefghijklmn
2
3 4
12 4
defg
mn

Resources

wxiaoping 2009年C语言第六次上机