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

public class SearchCountryRiverRunner {

	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 river: ");
			Scanner readRiver = new Scanner(System.in);
			String river = readRiver.next();
			
			boolean found = false;
			while (input.hasNext()) {
				String line = input.nextLine();
				if (line.toLowerCase().indexOf(river.toLowerCase()) != -1) {
					found = true;
					String[] arr = line.split(" ; ");
					System.out.println("River: "+ arr[0] + ". It is found in: "+arr[1]);
				}
			}
			if (!found)
				System.out.println("No river found named: " + river);
			readRiver.close();
			input.close();
		} catch (IOException e) {
			System.out.println("File not found: " + e.getMessage());
		}

	}
}
