Case #1:
123456789
Case #2:
Hello, welcome to my dream world!
Case #3:
Toodming is best
Case #4:
sokaisan
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define maxn 100000 + 10
char s1[maxn], s2[maxn*2];
int k, len;
void solve()
{
    strcpy(s2+1, "");
    cout<<"There is : "<<s2+1<<endl;
    len = strlen(s1+1);
    int mod = len % k;
    int n = len / k;
    if(mod) n++;
    if(n == 1)
    {
        printf("%s\n", s1+1);
        return;
    }
    int t1 = 1, t2 = 1;
    if(mod)
        while(1)
        {
            if(t2%n==0 && t2/n>mod)
                s2[t2++] = '*';
            else
            {
                s2[t2++] = s1[t1++];
            }
            if(t2 > n*k)
                break;
        }
    else
        strcpy(s2+1, s1+1);
    for(int i=1; i<=n; i++)
        for(int j=1; j<=k; j++)
    {
        if(s2[i+(j-1)*n] == '*') continue;
        else printf("%c", s2[i+(j-1)*n]);
    }
    cout<<endl;
    cout<<"s1: "<<s1+1<<endl;
    cout<<"s2: "<<s2+1<<endl;
    cout<<endl<<endl;
}
int main()
{
    int T;
    scanf("%d", &T);
    while(T--)
    {
        getchar();
        gets(s1+1);
        scanf("%d", &k);
        solve();
    }
    return 0;
}