#include #include #include #include #include #include #include #include #include #include using namespace std; #define LL long long #define N 100020 #define M 2020 #define eps 1e-10 #define inf 1e10 #define Pi acos(-1.0) #pragma comment(linker, "/STACK:1024000000,1024000000") vector v[N]; char s[N]; int main(){ int cas, kk = 0; scanf("%d", &cas); getchar(); while(cas--){ printf("Case #%d:\n", ++kk); gets(s); int k; scanf("%d", &k); getchar(); int n = strlen(s), cnt = 0; while(n > 0){ // cout << n << endl; int tmp = (n + k - 1) / k; for(int i = 0; i < tmp; ++i) v[i].push_back(s[cnt++]); n -= tmp, k--; } for(int i = 0; i < N; ++i){ int m = v[i].size(); if(m == 0) break; for(int j = 0; j < m; ++j) putchar(v[i][j]); v[i].clear(); } puts(""); } return 0; }