#include <stdio.h>
#include <string.h>char* substr(char *s, int startloc, int len) {static char result[51]; // 定义一个足够大的静态数组来存储结果static char result1[] = {'N','U','L','L','\0'};int i, j;// 检查startloc是否在字符串的范围内if (startloc < 1 || startloc > strlen(s)) {return result1; // 如果不在范围内,返回NULL}// 计算实际要复制的子串长度int actual_len = (startloc + len-1 < strlen(s)) ? len : (strlen(s) - startloc+1);// 复制子串到结果数组for (i = startloc-1, j = 0; i < startloc + actual_len-1; i++, j++) {result[j] = s[i];}result[j] = '\0'; // 添加字符串结束符return result; // 返回结果
}int main() {int t;scanf("%d",&t);while(t--){char a[100];scanf("%s",a);int x,y;scanf("%d %d",&x,&y);printf("%s\n", substr(a, x, y));}return 0;
}