Junior — Senior
Number formatting function with digit grouping
livecode
Task condition
It is necessary to implement a function that takes an integer and returns a string where the number is broken down into its digits with their respective weights.
Example of the function:
- input: 12
- output: "10 + 2"
Output format: each digit value (descriptor) is connected with a "+" sign with spaces on both sides. If the number consists of a single digit, the string containing only the number without a plus sign is returned.
The function should be written so that it correctly handles any non-negative integers, including zero.