Codeforces Beta Round 64
B
Text Messaging
Codeforces
1600
原题
← AC →
翻译中…

Fangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing $*n*$ characters (which is the size of one text message). Thus, whole sentences and words get split!

翻译中…

Fangy did not like it, so he faced the task of breaking the text into minimal messages on his own so that no sentence were broken into pieces when it is sent and the number of text messages to be sent would be minimal. If two consecutive sentences are in different messages, the space between them can be ignored (Fangy does not write this space).

翻译中…

The little walrus's text looks in the following manner:

翻译中…

TEXT ::= SENTENCE | SENTENCE SPACE TEXT
SENTENCE ::= WORD SPACE SENTENCE | WORD END
END ::= {'.', '?', '!'}
WORD ::= LETTER | LETTER WORD
LETTER ::= {'a'..'z', 'A'..'Z'}
SPACE ::= ' '

翻译中…

SPACE stands for the symbol of a space.

翻译中…

So, how many messages did Fangy send?

翻译中…

Input

翻译中…

The first line contains an integer $*n*$, which is the size of one message ($2 ≤ *n* ≤ 255$). The second line contains the text. The length of the text does not exceed $10^{4}$ characters. It is guaranteed that the text satisfies the above described format. Specifically, this implies that the text is not empty.

翻译中…

Output

翻译中…

On the first and only line print the number of text messages Fangy will need. If it is impossible to split the text, print "Impossible" without the quotes.

翻译中…

Note

翻译中…

Let's take a look at the third sample. The text will be split into three messages: "Hello!", "Do you like fish?" and "Why?".

翻译中…

样例

Input #1
25
Hello. I am a little walrus.
Output #1
2
InputCopy OutputCopy
Input #2
2
How are you?
Output #2
Impossible
InputCopy OutputCopy
Input #3
19
Hello! Do you like fish? Why?
Output #3
3
InputCopy OutputCopy
题目信息
题号
70B
时间限制
1 s
内存限制
256 MB
标签
表达式解析
贪心
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。