Convert a large int (e. g. 1234567890) into a string containing the usual decimal prefixes k, M, G, T, etc. for kilo, mega, giga, tera, etc. The result shall be groups of three digits, interspersed by the prefixes (e. g. 1G234M567k890
), so that it is easy to glance the order of magnitude of the number without counting the digits.
It shall work for numbers of all digit counts up to 15. Only non-negative numbers are allowed as input.
More test cases:
0 → 0
123 → 123
1234 → 1k234
1000 → 1k000
1000000000 → 1G000M000k000
1000234 -> 1M000k234
\$\endgroup\$1G000M000k000
much harder to parse than1 000 000 000
\$\endgroup\$