def main(): """Unit tests the ST data type.""" st = ST() st.put("A", 1) st.put("B", 1) st.put("B", 2) st.put("B", 3) st.put("B", 4)
def main(): keyField = int(sys.argv[1]) valField = int(sys.argv[2]) st = ST() # Command-line interface: reads data from stdin, stream, or files items_in = [w.rstrip("\n\r") for t in fileinput.input() for w in t.split(" ")] # read in the data from csv file In in = new In(args[0]) while (in.hasNextLine()): String line = in.readLine() String[] tokens = line.split(",") String key = tokens[keyField] String val = tokens[valField] st.put(key, val) while (!StdIn.isEmpty()): String s = StdIn.readString() if st.contains(s)) prt.write(st.get(s)) else prt.write("Not found")