Retweet twinter
The Twinter project, inspired by the phrase "the winter," is a social network where users share their preparations for the upcoming winter. Each post on this platform is called a twint. Initially, twints were limited to 140 characters, but this limit has recently been increased to 280 characters.
When users need to convey a longer message, they typically divide it into multiple twints. Each twint in a series is numbered to indicate its position and the total number of twints, like so:
Winter!.. The peasant, rejoicing, (1/2)
refreshes the path on the sled. (2/2)
The creators of Twinter have decided to automatically reformat old twint series to fit within the new 280-character limit. Your task is to help them by reformatting the given series into the fewest possible number of twints. Words—defined as sequences of characters without spaces—must remain intact and cannot be split between twints. The characters at the end of a twint, "(i=n)", which indicate the twint's sequence number and the total number of twints, must also be included in the character count.
Input Data
The first line contains an integer n, representing the number of twints in the original series (1 ≤ n ≤ 5000).
Each of the next n lines contains a twint, which is no longer than 140 characters and ends with the format "(i/n)", where i is the twint's sequence number. Twints do not begin with a space and do not have consecutive spaces. They may include spaces, Latin letters, digits, and punctuation marks (with ASCII codes from 33 to 63).
Output Data
On the first line, output the number m, which is the number of twints in the newly formatted series.Then, print each twint of the series on a new line. These twints should not start with a space or contain consecutive spaces, and they should end with "(i/m)", similar to the input format. The order of words in the original series must be preserved in your output.