/* -*- coding: utf-8 -*- * * 3274.cc: No.3274 Arithmetic Right Shift - yukicoder */ #include #include #include using namespace std; /* constant */ const int MAX_N = 64; /* typedef */ /* global variables */ char s[MAX_N + 4]; /* subroutines */ /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { int k; scanf("%d%s", &k, s); int n = strlen(s); k = min(k, n - 1); for (int i = n - 1; i >= 1; i--) s[i] = s[max(0, i - k)]; puts(s); } return 0; }