plaintext
function helpfulMaths(s)
count1 := 0
count2 := 0 count3 := 0
for each character c in s
if c = '1' then
count1 := count1 + 1
else
if c = '2' then
count2 := count2 + 1
else
if c = '3' then
count3 := count3 + 1 // skip '+' characters
result := "" first := true
for i from 1 to count1
if not first then
result := result + "+" result := result + "1"
first := false
for i from 1 to count2
if not first then
result := result + "+"
result := result + "2" first := false
for i from 1 to count3
if not first then
result := result + "+" result := result + "3"
first := false
return result
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/cpp/control-flow/helpful-maths-implementation
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████████████████████████████████████████████████████████████████████