Print Sentences as Table
Complete the function below. The function receives the full standard input as a single string and must return the exact standard output lines for the described problem.
You are given n sentences and a fixed table content width width. Print each sentence as one row in a bordered table.
Input
The first line contains two integers n and width. The next n lines each contain one sentence. Sentences may contain spaces, and each sentence length is guaranteed to be at most width.
Output
For each sentence, output a border line, then the sentence row, then continue with the next border line. A border line is +, followed by width + 2 dash characters, followed by +.
A sentence row starts with | , then the sentence, then enough trailing spaces to fill exactly width content characters, then |.
If n = 0, return no output lines.
Example
Input: 3 55, followed by Hello world, How are you today, and Bye.
The sample output is shown in the visible example.
Complete solvePrintSentencesAsTable. It has one parameter, String input, containing the full stdin payload. Return the stdout payload as an array of lines, without trailing newline characters.
1Example 1
The returned string array must match the expected standard output lines for the sample input.
Constraints
Limits and guarantees your solution can rely on.
0 <= n <= 10^51 <= width <= 10^4- Each sentence contains printable ASCII characters and spaces.
- Each sentence length is at most
width.