# [Python 2], 57 bytes <!-- language-all: lang-python --> f=lambda s,p="":s and f(s[:-3],p[1:]+"kMGT")+s[-3:]+p[:1] [Try it online!][TIO-k1msheti] [Python 2]: https://docs.python.org/2/ [TIO-k1msheti]: https://tio.run/##K6gsycjPM/r/P802JzE3KSVRoVinwFZJyapYITEvRSFNozjaStc4Vqcg2tAqVlsp29c9RElTuzha1xjILYi2Moz9n5ZfpBCvkJmnUJSYl56qYWiqacXFWVCUmVcC1J6ZV1BaoqGp@V/J0EiJC0gYQ0gTKGUKo83gDHMEywKJaYnMNkDhoPHQuRh8TAEDJQA "Python 2 – Try It Online" Takes input as a string. If the output may have a trailing space, we can avoid some workarounds and save 3 bytes. **54 bytes** <!-- language-all: lang-python --> f=lambda s,p=" kMGT":s and f(s[:-3],p[1:])+s[-3:]+p[0] [Try it online!][TIO-k1msic95] [Python 2]: https://docs.python.org/2/ [TIO-k1msic95]: https://tio.run/##K6gsycjPM/r/P802JzE3KSVRoVinwFZJIdvXPUTJqlghMS9FIU2jONpK1zhWpyDa0CpWU7s4WtfYKla7INog9n9afpFCvEJmnkJRYl56qoahqaYVF2dBUWZeCVBbZl5BaYmGpuZ/JUMjJS4gYQwhTaCUKYw2gzPMESwLJKYlMtsAhYPGQ@di8DEFDJQA "Python 2 – Try It Online"