import java.util.*;

public class Verifier
{
    public static final String EXAMPLE_DATA = "example.txt";

    public Verifier (boolean debug)
    {
        _debug = debug;
    }

    public boolean verify ()
    {
        Vector<Category> cats = Util.loadCategories(EXAMPLE_DATA, _debug);
        Vector<Ticket> ticks = Util.loadTickets(EXAMPLE_DATA, _debug);
        Vector<Ticket> validTickets = Util.validTickets(cats, ticks);

        if (_debug)
        {
            for (int j = 0; j < validTickets.size(); j++)
                System.out.println(validTickets.elementAt(j));
        }

        for (int i = 1; i < validTickets.size(); i++)
        {
            int[] values = validTickets.elementAt(i).values();
            int number = 0;

            for (int k = 0; k < cats.size(); k++)
            {
                for (int l = 0; l < values.length; l++)
                {
                    if (!cats.elementAt(k).valid(values[l]))
                    {
                        number++;
                        break;
                    }
                }
            }
            
            System.out.println("Ticket "+validTickets.elementAt(i)+" matches "+number+" categories.");
        }

        return false;
    }

    private boolean _debug;
}
@@ -599,47 +599,43 @@
     
-for (int i = 1; i %3C validT
+int%5B%5D firsts = new int%5Bt
 ick
-et
 s.size()
 ; i+
@@ -634,14 +634,14 @@
 ze()
-; i++)
+ -1%5D;%0A
 %0A   
@@ -649,48 +649,76 @@
     
-%7B%0A            int%5B%5D values = validT
+for (int i = 0; i %3C firsts.length; i++)%0A            firsts%5Bi%5D = t
 ick
-et
 s.el
@@ -726,16 +726,18 @@
 mentAt(i
++1
 ).values
@@ -742,43 +742,14 @@
 es()
-;%0A            int number = 0;%0A%0A    
+%5B0%5D;%0A%0A
     
@@ -794,33 +794,26 @@
 ++)%0A        
-    %7B%0A   
+%7B%0A
             
@@ -804,33 +804,32 @@
   %7B%0A            
- 
 for (int l = 0; 
@@ -832,21 +832,21 @@
  0; l %3C 
-value
+first
 s.length
@@ -860,34 +860,26 @@
             
-  
-  %7B%0A    
+%7B%0A
             
@@ -890,9 +890,8 @@
 if (
-!
 cats
@@ -910,21 +910,21 @@
 ).valid(
-value
+first
 s%5Bl%5D))%0A 
@@ -946,73 +946,84 @@
     
-%7B%0A                        number++;%0A                        break
+System.out.println(%22Category %22+cats.elementAt(k)+%22 is valid for %22+firsts%5Bl%5D)
 ;%0A  
@@ -1028,37 +1028,36 @@
                 
-    %7D
+else
 %0A               
@@ -1053,45 +1053,8 @@
     
-        %7D%0A            %7D%0A            %0A
     
@@ -1085,27 +1085,21 @@
 ln(%22
-Ticket %22+validTicke
+Category %22+ca
 ts.e
@@ -1111,46 +1111,55 @@
 tAt(
-i
+k
 )+%22 
-matches %22+number+%22 categories.%22);
+is invalid for %22+firsts%5Bl%5D);%0A            %7D
 %0A   

Update Verifier.java