# Input description

A string (for best results, all characters should be printable and be the same width).

# Output description

A character star following the pattern:

0  0  0
1 1 1
222
0123210
222
1 1 1
0  0  0


where 0, 1 ... are subsequent characters of the string. The output does not necessarily have to be one string - printing the star char by char into the console is fine.

# Example

>> star('overflow')
>>
o      o      o
v     v     v
e    e    e
r   r   r
f  f  f
l l l
ooo
overflowolfrevo
ooo
l l l
f  f  f
r   r   r
e    e    e
v     v     v
o      o      o

• I think "a string" should be a little more clear, do you mean a string consisting of only printable ASCII? – FryAmTheEggman Feb 22 '16 at 18:36
• I think "a string" is sufficient. Of course, for best results you probably want to avoid tabs or other characters that would distort the shape of the output, but that doesn't mean you can't include them. Still, I updated the description for clarity. – shooqie Feb 22 '16 at 18:41
• It's less a question of whether that gives the nicest results but of whether answers have to support it. Some languages might have to use somewhat different code if e.g. non-ASCII (Unicode) characters have to be supported as well. Likewise, some code might be shorter if we can assume that unprintables won't appear (specifically linefeeds). – Martin Ender Feb 22 '16 at 18:52
• Whether or not you can print all characters is irrelevant. If you can make your code shorter, even if it limits you from printing certain characters (like Unicode), then so be it. I think that's the spirit of code-golfing anyway. As long as your program supports common characters, it's fine. If it doesn't, then I don't think the challenge specification is the problem. – shooqie Feb 22 '16 at 19:40

## Pyth, 37 bytes

jKm:*;t*2lz[dtlzt_d)*3@zdtlz)pzt_zj_K


Try it here!

## Perl, 97 93 + 2 = 95 bytes

$i=y///c-2;push@a,map{$"x$j++.$_.($"x$i--.$_)x2}/.(?!$)/g;say for@a,s/.$//r.reverse,reverse@a  Requires -nlE flags: $ perl -nlE'$i=y///c-2;push@a,map{$"x$j++.$_.($"x$i--.$_)x2}/.(?!$)/g;say for@a,s/.$//r.reverse,reverse@a' <<< 'overflow' o o o v v v e e e r r r f f f l l l ooo overflowolfrevo ooo l l l f f f r r r e e e v v v o o o  Ungolfed: $i=y///c-2;
push @a, map{
$" x$j++ .
$_ . ($" x $i-- .$_)x2
} /.(?!$)/g; say for @a, s/.$//r.reverse, reverse@a


## Seriously, 57 bytes

╩╜#dXΣR;╝;lr;R3Zi' *;(;;))@(((@)' *;)kΣM;R@k'
jMi╛╜+@


Yes, that newline is supposed to be there. Yes, Seriously still sucks at string manipulation. Hexdump (reversible with xxd -r):

00000000: cabd 2364 58e4 523b bc3b 6c72 3b52 335a  ..#dX.R;.;lr;R3Z
00000010: 6069 2720 2a3b 283b 3b29 2940 2828 2840  i' *;(;;))@(((@
00000020: 2927 202a 3b29 6be4 604d 3b52 406b 6027  )' *;)k.M;R@k'
00000030: 0a6a 604d 69be bd2b 40                   .jMi..+@


I'll update this with an explanation once I finish writing it up. It's kinda long.

## ES6, 153 bytes

s=>[...a=(t=[...s.slice(0,-1)]).map((c,i)=>(a=Array(t.length).fill ,a[i]=c,a.join+c+a.reverse().join)),s+t.reverse().join,...a.reverse()].join\n


Ungolfed:

function star(s) {
r = [];
h = s.length - 1;
for (i = 0; i < h; i++) {
a = [...' '.repeat(h)];
a[i] = s[i];
a = a.concat(s[i]).concat(a.reverse());
r.push(a.join(''));
}
return r.concat(s + [...s.slice(0,h)].reverse().join('')).concat(r.reverse()).join("\n");
}


Alternative solution, also 153 bytes:

s=>[...a=(t=[...s].reverse().slice(1)).map((c,i)=>(a=Array(l+l+1).fill ,a[i]=a[l]=a[l+l-i]=c,a.join),l=t.length),s+t.join,...a.reverse()].join\n


Ungolfed:

function star(s) {
r = [];
h = s.length - 1;
for (i = 0; i < h; i++) {
a = [...' '.repeat(h + h + 1)];
a[i] = s[i];
a[h] = s[i];
a[h + h - i] = s[i];
r.push(a.join(''));
}
return r.concat(s + [...s].reverse().slice(1).join('')).concat(r.reverse()).join("\n");
}


Note: The \n inside `s is a literal newline character.