////.................
if (k > 2)
cout << napis[i-1] << k;
else if (k == 2)
cout << napis[i-1] << napis[i-1];
else
cout << napis[i-1];
////..................
Ly8vLy4uLi4uLi4uLi4uLi4uLi4uCgogICAgICAgICAgICBpZiAoayA+IDIpCiAgICAgICAgICAgICAgICBjb3V0IDw8IG5hcGlzW2ktMV0gPDwgazsKICAgICAgICAgICAKICAgICAgICAgICAgZWxzZSBpZiAoayA9PSAyKQogICAgICAgICAgICAgICAgY291dCA8PCBuYXBpc1tpLTFdIDw8IG5hcGlzW2ktMV07CiAgICAgICAgICAgCiAgICAgICAgICAgIGVsc2UgCiAgICAgICAgICAgIAljb3V0IDw8IG5hcGlzW2ktMV07Ci8vLy8uLi4uLi4uLi4uLi4uLi4uLi4K