/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package codejam.common;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Lance Chen
 */
public class CodeHelper {

    private static String FILE_ROOT = "D:/workspace/googlecodejam/meta";

    public static List<List<String>> loadInputsExcludes(String fileName) {
        List<List<String>> result = new ArrayList<List<String>>();
        List<String> lines = FileUtil.readLines(FILE_ROOT + fileName);
        int index = 0;
        for (String line : lines) {
            if (index == 0) {
                index++;
                continue;
            }
            if (index % 2 == 1) {
                index++;
                continue;
            }
            List<String> dataList = new ArrayList<String>();
            String[] dataArray = line.split("\\s+");
            for (String data : dataArray) {
                if (data.trim().length() > 0) {
                    dataList.add(data);
                }
            }
            result.add(dataList);
            index++;
        }
        return result;
    }

    public static List<List<String>> loadInputs(String fileName) {
        List<List<String>> result = new ArrayList<List<String>>();
        List<String> lines = FileUtil.readLines(FILE_ROOT + fileName);
        for (String line : lines) {
            List<String> dataList = new ArrayList<String>();
            String[] dataArray = line.split("\\s+");
            for (String data : dataArray) {
                if (data.trim().length() > 0) {
                    dataList.add(data);
                }
            }
            result.add(dataList);
        }
        return result;
    }

    public static List<String> loadInputLines(String fileName) {
        return FileUtil.readLines(FILE_ROOT + fileName);
    }

    public static void writeOutputs(String fileName, List<String> lines) {
        FileUtil.writeLines(FILE_ROOT + fileName, lines);
    }
}

/*
 * Main.java
 * 
 * Created on 14.04.2012, 10:03:46
 * 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package codejam12;

import qualification.CodeJamQuali;

/**
 *
 * @author Besitzer
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    /*public static void main(String[] args) {
        char[] C = new char[26];      
        CodeJamQuali CJQ =new CodeJamQuali();
        CJQ.fillDict("our language is impossible to understand","ejp mysljylc kd kxveddknmc re jsicpdrysi",C);
        CJQ.fillDict("there are twenty six factorial possibilities","rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd",C);
        CJQ.fillDict("so it is okay if you want to just give up","de kr kd eoya kw aej tysr re ujdr lkgc jv",C);
        C['z'-'a']='q';        
        C['q'-'a']='z';
        System.out.println("abcdefghijklmnopqrstuvwxyz");
        System.out.println(C);
        for(int i =0;i<26;i++)if(C[i]=='z')System.out.println("found");
        
    }*/
    
    public static void main(String[] args) {

        CodeJamQuali CJQ =new CodeJamQuali();
        //CJQ.go("src/qualification/A-small-attempt0.in", 1);
        CJQ.go("src/qualification/B-small-attempt0.in", 2);
        
    }

}
