import java.io.*; public class Prob5{ public static void main (String[] args)throws Exception{ BufferedReader in = new BufferedReader(new FileReader("DATA51.txt")); PrintWriter out = new PrintWriter(new FileWriter("OUT51.txt")); for(int asdf =0; asdf<5; asdf++){ String dude = in.readLine(); String newdude = ""; dude = dude.toLowerCase(); for (int i = 0; i < dude.length(); i++){ if ((int)(dude.charAt(i)) > 96 && (int)(dude.charAt(i)) < 123) newdude = newdude + dude.charAt(i); } String name = ""; boolean found = false; for (int i = 0; i<10; i++){ switch(i){ case 0: name = "britishcolumbia"; break; case 1: name = "alberta"; break; case 2: name = "saskatchewan"; break; case 3: name = "manitoba"; break; case 4: name = "ontario"; break; case 5: name = "quebec"; break; case 6: name = "novascotia"; break; case 7: name = "newfoundland"; break; case 8: name = "newbrunswick"; break; case 9: name = "princeedwardisland"; break; } if (newdude.indexOf(name) != -1){ found = true; switch(i){ case 0: name = "British Columbia"; break; case 1: name = "Alberta"; break; case 2: name = "Saskatchewan"; break; case 3: name = "Manitoba"; break; case 4: name = "Ontario"; break; case 5: name = "Quebec"; break; case 6: name = "Nova Scotia"; break; case 7: name = "Newfoundland"; break; case 8: name = "New Brunswick"; break; case 9: name = "Prince Edward Island"; break; } out.println(name); } }//end big loop if (!found){ out.println("NO PROVINCE FOUND"); } }//end really big loop in.close(); out.close(); } }