char *str = malloc(sizeof(char) * 1000);
memset(str, '0', sizeof(char) * 1000);
scanf("%s", str);
int idx = 0;
int cnt = 0;
while (idx <= 1000)
{
if (str[idx] != '0')
{
cnt++;
}
else
{
break;
}
idx++;
}
cnt--;
char **tails = (char**)malloc(sizeof(char*) * cnt);
idx = 0;
while (idx < cnt)
{
tails[idx] = (char*)malloc(sizeof(char) * cnt);
idx++;
}
idx = 0;
while(idx < cnt)
{
int idx2 = idx;
while(idx2 < cnt)
{
tails[idx][idx2] = str[idx2];
idx2++;
}
idx++;
}
idx = 0;
while(idx < cnt)
{
int idx2 = idx;
while(idx2 < cnt)
{
write(1, &tails[idx][idx2], 1);
idx2++;
}
idx++;
write(1, "\n", 1);
}
idx = 0;
while(idx < cnt)
{
free(tails[idx]);
idx++;
}
free(tails);