magic-pass-code-1

Problem Description

Apparently, the key that would take Alice home from her Wonderland adventure is a magic pass code hidden in numbers.

Help her find it! It's the one with the highest sum of its digits!

Input Format

Input consists of several integer n, each separated by a newline character.

Output Format

Output Alice's magic code -- the integer with the maximum sum of its digits!

Constraints

0 < n ≤ 100000

SAMPLE INPUT
23
496

SAMPLE OUTPUT
496

Source: hackerearth | Difficulty: EASY


Solutions:
alls = []
while True:
	failed = False
	try:
		s = input()
	except:
		failed = True
		break
	if len(s.rstrip().lstrip())==0:
		failed = True
		break   
	alls.append(s) 
	
if len(alls)> 0:
	winner = ''
	maxs   = 0
	for y in alls:
		csum = sum(int(x) for x in y)
		if csum > maxs:
			maxs = csum
			winner= y
	print(winner)
	exit()
exit()    
	 
		
	
	



alls = []
while True:
	failed = False
	try:
		s = input()
	except:
		failed = True
		break
	if len(s.rstrip().lstrip())==0:
		failed = True
		break   
	alls.append(s) 
	
if len(alls)> 0:
	winner = ''
	maxs   = 0
	for y in alls:
		csum = sum(int(x) for x in y)
		if csum > maxs:
			maxs = csum
			winner= y
	print(winner)
	exit()
exit()