Hide

Problem D
Mumble Rap

Languages en sv

Willó listens to several different music genres and usually talks to both his friends about his favorite artists. One day, Willó asked her parents if they were willing to pay for a ticket to a music festival. The parents agreed to it at first, but his mother became quite hesitant when she realized that it was not just any music festival, but a mumble rap music festival!

Willó’s mother asked Willó how he could have an interest in such an incomprehensible music genre, as she found it difficult to identify numbers from words that the artist is mumbling. According to Willó’s mother, mumble rap is known to be a genre where the artist always raps about how much money they own in a mumbling fashion. But Willó wanted to show love for mumble rap and prove his mother wrong, so he came up with the following plan: Willó wants to write a program that can identify the largest number in a string of characters that an artist has mumbled.

Input

The first line consists of an integer $1 \leqslant N \leqslant 10^6$, the number of characters in the string. The second line consists of $N$ characters in a string without spaces, where each character is either a letter from “a”-“z”,“A”-“Z”, a symbol (“.,;:?!”), or a digit between $0$ and $9$, including $0$ and $9$.

Output

Print an integer $0 \leqslant A \leqslant 10^9$ - The largest integer mentioned in the string. It is guaranteed that there is always a number in the string.

Grading

Your solution will be tested on a number of test-case groups. To receive points for a group, your solution must correctly solve every test-case in the group.

Group

Point value

Constraints

$1$

$20$

$A \leqslant 9$

$2$

$20$

The largest integer in the string is the last integer mentioned in the string.

$3$

$30$

$N \leqslant 10^3$

$4$

$30$

No further restrictions

Sample Input 1 Sample Output 1
29
ihave40dollarsinmybankaccount
40
Sample Input 2 Sample Output 2
33
yesterdayihad1001,BUTnowihave9999
9999
Sample Input 3 Sample Output 3
19
13twenty209sixty123
209