solution to sumocoders problem