#include <stdio.h>
// #include <string.h>
// void f(char *s, char *t)
// {
// char buf[11];
// int i, len = strlen(s);
// for (i = 0; i < len; i++) {
// strcpy(buf, t);
// strcpy(buf, s + i);
// puts(buf);
// }
// for (i = 10 - 1; i >= 0; i--) {
// strcpy(buf, t);
// if (10 - i > len)strcpy(buf + i, s);
// else memcpy(buf + i, s, 10 - i);
// puts(buf);
// }
// }
void f(char *s)
{
int i, len = 0;
char buf[21];
while (s[len])++len;
for (i = 0; i <= len; ++i) {
sprintf(buf
, "%s%.*s", s
+ i
, i
, s
); }
}
int main()
{
char s[] = "Hello";
char t[11] = "**********";
char buf[21];
f(buf);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Ci8vICNpbmNsdWRlIDxzdHJpbmcuaD4KCi8vIHZvaWQgZihjaGFyICpzLCBjaGFyICp0KQovLyB7Ci8vICAgY2hhciBidWZbMTFdOwovLyAgIGludCBpLCBsZW4gPSBzdHJsZW4ocyk7Ci8vICAgZm9yIChpID0gMDsgaSA8IGxlbjsgaSsrKSB7Ci8vICAgICBzdHJjcHkoYnVmLCB0KTsKLy8gICAgIHN0cmNweShidWYsIHMgKyBpKTsKLy8gICAgIHB1dHMoYnVmKTsKLy8gICB9Ci8vICAgZm9yIChpID0gMTAgLSAxOyBpID49IDA7IGktLSkgewovLyAgICAgc3RyY3B5KGJ1ZiwgdCk7Ci8vICAgICBpZiAoMTAgLSBpID4gbGVuKXN0cmNweShidWYgKyBpLCBzKTsKLy8gICAgIGVsc2UgbWVtY3B5KGJ1ZiArIGksIHMsIDEwIC0gaSk7Ci8vICAgICBwdXRzKGJ1Zik7Ci8vICAgfQovLyB9Cgp2b2lkIGYoY2hhciAqcykKewogIGludCBpLCBsZW4gPSAwOwogIGNoYXIgYnVmWzIxXTsKICB3aGlsZSAoc1tsZW5dKSsrbGVuOwogIGZvciAoaSA9IDA7IGkgPD0gbGVuOyArK2kpIHsKICAgIHNwcmludGYoYnVmLCAiJXMlLipzIiwgcyArIGksIGksIHMpOwogICAgcHJpbnRmKCIlLjExc1xuIiwgYnVmKTsKICB9Cn0KCmludCBtYWluKCkKewogIGNoYXIgc1tdID0gIkhlbGxvIjsKICBjaGFyIHRbMTFdID0gIioqKioqKioqKioiOwogIGNoYXIgYnVmWzIxXTsKICBzcHJpbnRmKGJ1ZiwgIiVzJXMiLCBzLCB0KTsKICBmKGJ1Zik7CiAgcmV0dXJuIDA7Cn0=