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

public class RiversRunner {

	public static void searchRivers(Scanner sc, String country) {
		boolean found = false;
		while (sc.hasNext()) {
			String line = sc.nextLine();
			String[] words = line.split(" ; ");
				if (words[1].equalsIgnoreCase(country)) {
				found = true;
				System.out.println(line);
			}
		}
		if (!found)
			System.out.println("No river found in: " + country);
	}

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

			System.out.println("Enter the name of the country whose rivers are to searched: ");
			Scanner readCountry = new Scanner(System.in);
			String country = readCountry.next();

			searchRivers(input, country);
			readCountry.close();
			input.close();
		} catch (IOException e) {
			System.out.println("File not found: " + e.getMessage());
		}

	}
}
