In string "12345", out string "54321". Preferably without third party tools and regex.
I know you said "without third-party tools", but sometimes a tool is just too obviously the right one, plus it's installed on most linux systems by default:
[madhatta@risby tmp]$ echo 12345|rev 54321
2.1m questions
2.1m answers
60 comments
57.0k users