Привіт! Я вже кілька днів страждаю над цією задачею task:
The president was happy with your implementation of the TextFramePretifier… for one day. Then he decided that he wants to control the width of the frame. Take the code of the previous task and modify it to take an integer that represents the width of the frame and then print a message in the frame as you did in previous task, but using the given width this time. Write as many words as you can in each line; if there is an empty space, fill it with spaces. The number of words in a message will not exceed 100. All words are guaranteed to be shorter than (frameWidth - 4). Treat spaces as word separators and all other symbols, such as commas or question marks, as part of the word they’re connected to. The text is guaranteed to have only single spaces.
For example:
>15
>You look great today, sir!
Processing text: 1
***************
* You look *
* great *
* today, sir! *
***************
>A zebra does not change its spots.
Processing text: 2
***************
* A zebra *
* does not *
* change its *
* spots. *
***************
>exit
Свій код навіть наводити не буду, тому що ніяк не можу знайти підхід до вирішення задачі. Підказка від КодІзІ
One of the approaches is to treat spaces as 1 symbol words and then print as many words as you can in every line.
теж не допомагає, чомусь не можу уявити як це реалізувати(
можна будь-ласка попросити ще підказочку (більш явну)?