import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class LongShortRiversRunner {

	public static void main(String args[]) {
		try {
			File inputFile = new File("rivers.txt");
			Scanner input = new Scanner(inputFile);

			int max = Integer.MIN_VALUE; // can also be initialized to 0 in this case
			int min = Integer.MAX_VALUE; // can also be initialized to 0 in this case

			String riverLong = null;
			String riverShort = null;

			while (input.hasNext()) {
				String line = input.nextLine();
				String[] details = line.split(" ; ");

				int len = Integer.parseInt(details[2].trim());
				if (len > max) {
					riverLong = details[0];
					max = len;
				}

				if (len < min) {
					riverShort = details[0];
					min = len;
				}
			}
			System.out.println("Longest River: " + riverLong + " || Length: " + max);
			System.out.println("Shortest River: " + riverShort + " || Length: " + min);
			input.close();
		} catch (IOException e) {
			System.out.println("File not found: " + e.getMessage());
		}

	}
}
