/**************Powered by Graphene Richards**************/ //{ #define FLOAT_PRECISION 2 #define INT_64_MOD "%I64d" #define UNSIGNED_64_MOD "%I64u" //#pragma comment(linker,"/STACK:102400000,102400000") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define FAST_RW ios_base::sync_with_stdio(0),cin.tie(0); #define IT(x) __typeof((x).begin()) #define DIT(x) __typeof((x).rbegin()) #define FS(i,a) for(ll i=0;a[i];i++) #define FE(x,ctn) for(IT(ctn)x=(ctn).begin(),_en=(ctn).end();x!=_en;x++) #define EF(x,ctn) for(DIT(ctn)x=(ctn).rbegin(),_en=(ctn).rend();x!=_en;x++) #define FR(i,en) for(ll i=0,_en=(en);i<_en;i++) #define FOR(i,en) for(ll i=1,_en=(en);i<=_en;i++) #define RF(i,en) for(ll i=(en)-1;i>=0;i--) #define ROF(i,en) for(ll i=(en);i>0;i--) #define FFR(i,x,y) for(ll i=(x),_en=(y);i<=_en;i++) #define RFF(i,x,y) for(ll i=(x),_en=(y);i>=_en;i--) #define pc putchar #define pb push_back #define pq priority_queue #define fi first #define se second #define mp make_pair #define pii pair #define pll pair #define pdd pair #define lb(x) (x&(-x)) #define sqr(x) ((x)*(x)) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define clr(x) memset((x),0,sizeof(x)) #define ms(x,v) memset((x),(v),sizeof(x)) #define mc(x,y) memcpy((x),(y),sizeof(y)) #define NL puts(""); typedef unsigned ui; typedef long long ll; typedef unsigned long long ull; typedef long double lf; using namespace std; ull gcd(ull a,ull b){if(!b)return a;while(b^=a^=b^=a%=b);return a;} extern const ll MOD; ll ksm(ll a,ll b){ ll res=1; a%=MOD; for(;b;b>>=1){ if(b&1)res=res*a%MOD; a=a*a%MOD; } return res; } #ifdef wmx16835 #include"wmx16835.h" #else #define LOG #define TEL #define PF #define PC #define SF(...) #define SC #define test(...) 0 #define TEST(...) 0 #define TRY(...) #define PP #define SHOW_TIME #endif templatebool In(T1 x,T2 y,T3 z){return x<=y&&x>=z||x<=z&&x>=y;} templateT1 Max(const T1&a,const T2&b){return aT1 Max(const T1&a,const T2&b,const T3&c){return aT1 Min(const T1&a,const T2&b){return aT1 Min(const T1&a,const T2&b,const T3&c){return abool S(T1&a,T2&b){return S(a)+S(b)==2;} templatebool S(T1&a,T2&b,T3&c){return S(a)+S(b)+S(c)==3;} templatebool S(T1&a,T2&b,T3&c,T4&d){return S(a)+S(b)+S(c)+S(d)==4;} templatebool S(T1&a,T2&b,T3&c,T4&d,T5&e){return S(a)+S(b)+S(c)+S(d)+S(e)==5;} templatevoid P(const T1&a){_P(a);pc(' ');} templatevoid P(const T1&a,const T2&b){_P(a);pc(' ');_P(b);pc(' ');} templatevoid PN(const T1&a){_P(a);NL} templatevoid PN(const T1&a,const T2&b){_P(a);pc(' ');_P(b);NL} templatevoid PN(const T1&a,const T2&b,const T3&c){_P(a);pc(' ');_P(b);pc(' ');_P(c);NL} templatevoid PN(const T1&a,const T2&b,const T3&c,const T4&d){_P(a);pc(' ');_P(b);pc(' ');_P(c);pc(' ');_P(d);NL} templatevoid PN(const T1&a,const T2&b,const T3&c,const T4&d,const T5&e){_P(a);pc(' ');_P(b);pc(' ');_P(c);pc(' ');_P(d);pc(' ');_P(e);NL} void PS(int a){printf("%*s",a,"");} template void PA(T*a,int n){ bool f=1; FR(i,n){ if(f)f=0; else pc(' '); _P(a[i]); } NL } template void PA(const T&x){ bool f=1; FE(it,x){ if(f)f=0; else pc(' '); _P(*it); } NL } int kase; const double pi=4*atan(1); const double ep=1e-9; const int INF=0x3f3f3f3f; const ll INFL=0x3f3f3f3f3f3f3f3fll; const ll MOD=1000000007; //} char a[100005],res[100005]; int main(){ SHOW_TIME int T; S(T); while(T--){ int n,k; SL(a); S(k); n=strlen(a); res[n]=0; int x=0,y=0; FR(i,n){ res[x*k+y]=a[i]; x++; if(x*k+y>=n){ x=0,y++; } } printf("Case #%d:\n",++kase); PN(res); } } /*********Risoft corporation all rights reserved*********/ /**************Template V2.16 build 20150521*************/