What's the language on the one-liner? I know nothing about J, but it doesn't seem to run. Sorry; just a bit fascinated.
It's J also. Link which will run:
https://tio.run/##JYyxDoJAEER7v@LpWdzl4iJwoJiY6HcIlSERG0sKDb...
https://tio.run/##JYyxDoJAEER7v@LpWdzl4iJwoJiY6HcIlSERG0sKDb...
Or the 1-liner:
which surely could be golfed even further.