URI Online Judge | 3143

Escaping the Cell Phone

By Roger Eliodoro Condras, UFSC-ARA BR Brazil

Timelimit: 1

Ritcheli (and yes, that's his name) is a very nice guy and a great friend, but he has a serious problem. It takes a long time to respond to messages on social media. Being able to talk to him, even more so in these pandemic times, is an almost impossible mission.

While he is too lazy to pick up his cell phone to reply to messages as they arrive, he is also lazy to spend hours reading accumulated messages after spending days running away from his cell phone.

In an attempt to become a more active person on social networks and not let too many messages accumulate, he decided to adopt a new criterion for responding to messages: the number of lines of messages received. This is because the number of messages received is not a very accurate measure of the time he will spend reading the messages. It can receive 20 messages of 100 lines each and take much longer to read than if it had received 50 messages with one line each.

But there is a problem with all of this. Applications report only the number of messages received, not the number of lines accumulated from unread messages. So, Ritcheli would like your help to write an algorithm that counts the lines of messages received and reports the total lines to him. Can you help him with this task?

Some notes: Consider that each line of the message is always displayed with the same number of characters, the maximum number of characters that the mobile screen can display per line. When this number is exceeded, the remaining text is truncated and continues on the next line, regardless of whether the word is eventually cut in half. If the first character of the new line is a space, it is disregarded and the line starts at the next character other than a space. If a message ends in the middle of the line, with space left on that line, the next message starts on a new line, not in the middle of the previous line.


The first line of the entry has an integer N (10 \(\leq\) N \(\leq\) 1000), the number of characters that can fit per line on Ritcheli's cell phone screen.

The next lines have several strings and the reading of the file ends with EOF. Each line represents a message and is made up of printable characters from the ASCII Table. The length of each line does not exceed 10,000 characters, and the message does not begin or end with space characters.


A single line with an integer, the total number of lines that Ritcheli will have to read after computing all incoming messages.

Input Sample Output Sample

Oi Ritch
Eh o Roger
Vc ta vivo ainda? Faz dias q vc n me respondeu mais :(:(:(:(:(