Company: fidelity international Oncampus
Difficulty: medium
Consecutive Digits Problem Statement You are given a string str of length n . Your task is to find and print the maximum integer present in the string str . Note Print -1 if no integer is found. If string is empty then print -2 . Input Format The input consists of two lines: The first line contains an integer, i.e., n . The second line contains the string str . The input will be read from the STDIN by the candidate. Output Format Print the maximum integer present in the string str . Print -1 if no integer is found, if string is empty then print -2 . The output will be matched to the candidate's output printed on the STDOUT. Constraints 1 Example Input: 39 33 milestone is either 12 or 75 km away Output: 75 Explanation: The string str has 3 integers '33', '12' and '75'. Since 75 is the maximum, the output is 75.