Company: Deloitte_23feb
Difficulty: medium
Little Naruto along with his father went to a gaming zone in a shopping mall. In the gaming zone, Naruto's father found an interesting console game related to numbers, and asked Naruto to play it. In the game, a list of N numbers scrolls across the screen from left to right. Before the number exits the screen, the player is expected to remove all occurrences of the largest and smallest digits from the number and type the remaining number with the balance digits in the same order. The total reward amount the player wins is equal to the sum of all the correctly entered numbers. After playing for a while, Naruto was confident he had typed all the numbers correctly, and was curious about the reward amount he won. Can you help with a program that accepts the list of N numbers which scrolled on the screen, and assuming Naruto got all the numbers right, print the total reward amount Naruto would win? Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings anyw