Inspired by a tweet by Nathan W. Pyle

There is, now, a standard method of converting your boring, normal human name into a mysterious, ethereal Ghost Name™️. Ably described by Mr Pyle...

Use your first name:

a - add “t” after it 

e - add “boo” after it 

h - becomes “s”

n - add “oo” after it 

r - add “eee” after it 

y - add “oo” after it

that’s it that’s your ghost name

(Note that the rule for h is a substitution, not an append)

Well, needless to say we don't want to waste too many chars of code converting your name, time for some golfing!

The task:

  • Convert a single-word string of a name into a Ghost Name™️
  • Your code will accept a string and output a string
  • Upper-case letters will still be converted. The appended strings will appear after an upper-case version of their letter, and an upper-case H will become an upper-case S.
  • Spaces, punctuation, anything other than the prescribed letters will remain unchanged.


  • It's code golf, attempt to make the Ghost Name™️ conversion in as few bytes as possible.
  • Please include a link to an online interpreter, such as TIO.

Test Cases

Andrew               > Atnoodreeeeboow
Stephanie            > Steboopsatnooieboo
Harry                > Satreeereeeyoo
Tim                  > Tim
Tonleeboo            > Tonoolebooebooboo
Great Britain        > Greeeebooatt Breeeitatinoo
L33t H4x0rz          > L33t S4x0reeez
cat🐱face🐱emoji       > catt🐱fatceboo🐱eboomoji

Satppyoo golfinoog!

  • 3
    \$\begingroup\$ This doesn't really seem that interesting. It's just string replacement, which will be the same in basically every language (and it's basically a dupe of every other similar challenge, including the one posted less than a minute before this one). \$\endgroup\$ Sep 16, 2021 at 14:57
  • 2
    \$\begingroup\$ I am voting to close this as a duplicate of Translate English to English because it is also just about applying a list of string replacements. \$\endgroup\$ Sep 16, 2021 at 15:18
  • \$\begingroup\$ @BrowncatPrograms I think I might have worked out where that downvote came from... Although it specifically is not a duplicate. It holds the challenge of multiple overlapping string subs (e.g. the appended 'eee' should not result in further 'e' appends.) And unusually contains two kinds of string transformation). - I believe your second comment may have been for another challenge, which you consider identical to this one. \$\endgroup\$
    – AJFaraday
    Sep 16, 2021 at 15:19
  • 2
    \$\begingroup\$ No downvotes from me. I do think they're basically duplicates though, it's just a list of regexes you need to replace. The trivial difference of overlapping string subs can be fixed by changing the replacement order, and the two kinds of string transformation are just replacement and replacement with a string containing the original string. \$\endgroup\$ Sep 16, 2021 at 15:21

1 Answer 1


JavaScript (Node.js), 92 bytes


Try it online!


s =>              // s = input string
s.replace(        // replace in s:
  /[aehnry]/gi,   //   look for all instances of these characters,
                  //   ignoring their case
  c =>            //   for each character c:
  [               //     lookup table:
    c + 'boo',    //       0: add 'boo' to 'e'
    c + 't',      //       1: add 't' to 'a'
    c + 'eee',    //       2: add 'eee' to 'r'
    c > {} ? 's'  //       3: turn 'h' into 's' and 'H' into 'S'
           : 'S', //
    c + 'oo'      //       4: add 'oo' to either 'n' or 'y'
  ]               //
  [               //     hash function:
    Buffer(c)[0]  //       ASCII code modulo 16 modulo 5
    % 16 % 5      //       (this is case insensitive)
  ]               //
)                 // end of replace()

Not the answer you're looking for? Browse other questions tagged or ask your own question.