Problem4002--CCC09J4 Signage

4002: CCC09J4 Signage

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 0
[Submit] [Status] [Web Board] [Creator:]

Description

The student council at Central Canada Collegiate is preparing signs with the message WELCOME TO CCC GOOD LUCK TODAY on various walls around the school. A sign is wide enough to hold w characters on each row, including spaces, as befits the wall to be decorated.
Here is how the words are put onto a sign. First, as many words as possible are placed on the first line, without exceeding the w character limit. The first word in the line begins in the leftmost position. If there is more than one word in the line, the last word ends in the rightmost position. Extra spaces are inserted into the gaps between the words so that the gaps are as similar as possible. If the gaps cannot be made equal, all of the larger gaps should appear to the left of the smaller ones. Subsequent lines are constructed in the same way. 
Your program will read the available width w and output the sign on the screen. Use the “.” character to indicate a space. 
Constraints
 You may assume that w ≥ 7. 

Input

Enter w: 15

Output

WELCOME..TO.CCC 
GOOD.LUCK.TODAY 

Sample Input Copy

Enter w: 26

Sample Output Copy

WELCOME..TO..CCC.GOOD.LUCK
TODAY.....................

Source/Category

CCC