Given a character limit and a message, split the message up into annotated chunks without cutting words as, for example when sending the SMS
"It is an amazing experience to give tests on Doselect!!" with char limit 17, you should get
["It is an,(1/6)", "amazing(2/6)", "experience(3/6)","to give(4/6)","tests on(5/6)","Doselect!!(6/6)"]
Can anyone help me with this question in cpp?
A greedy approach seems to be most optimal, no? Just add the words one by one while they fit.
And then what about whitespace i tried with one by one but it is taking some half words like "It is an amazing","experience to giv","etest on DoSelect"...like this
If a word would be cut in half just don't add it, start a new message instead. It's optimal.