**PROBLEM LINK** -

Author and Editoriallist - AmirReza PoorAkhavan

Tester - MohammadSina Pakseresht

Second Tester - Shayan CheshmJahan

**DIFFICULTY** –

Cakewalk

**PREREQUISITES** –

Nothing.

### PROBLEM

Given a list of N + 1 numbers, N mixed up with them, find the maximum number between this N numbers.

### EXPLANATION

Let A be the original list of size N. The number N was added in this list. Let the updated list be B. We can find the list A from the list B by finding any occurrence of the number N and deleting it. Finding maximum in a list can be done by iterating over its elements in linear time.

**Parsing the input into a list of integers**

For reading a line from standard input, you can use

```
getline(cin, s)
```

, it will read a line and save it in string s.

```
You can parse the input string into integers as follows. Use [string stream][4], read a line by
```

getline

```
and put it into some stringstream, then read ints one by one until it has some. You can check if it has some using
```

ss >> a

```
, it will return false if nothing is remained in stringstream (see my code for better understanding).
**IMPLEMENTATION** -
Setter's code - [here][1] (using getline and stringstream).
Tester's code - [here][2] (using getline and parsing the input manually).
Second tester's code - [here][3] (using getline and parsing the input manually).
[1]: http://www.codechef.com/download/Solutions/LTIME50/Setter/LOSTMAX.cpp
[2]: http://www.codechef.com/download/Solutions/LTIME50/Tester1/LOSTMAX.cpp
[3]: http://www.codechef.com/download/Solutions/LTIME50/Tester2/LOSTMAX.cpp
[4]: http://www.cplusplus.com/reference/sstream/stringstream/
```