Since "discussion" sections on hackerrank of every problem is filled with solutions I don't feel like there is any need to hide mine.
I won't post every solution here. Probably. But I'll try to do it daily for a while.
Also my personal opinion is that it's just bunch of hacks to make you feel good about yourself. It's not much better than some "brain puzzle" that LinkedIn aggressivly promotes. In real life you would be changing color of a button. Perhaps that's why there is no Nobel prize for mathematics.
Run like so
clear && time npx tsx SpecialStringAgain.ts