public static void compress() {
		String s = BinaryStdIn.readString(); // input
		char[] input = s.toCharArray();
		
		// tabulate freq counts
		int[] freq = new int[R];
		for (int i = 0; i < R; i++)
			freq[input[i]]++;
		
		// build huffman trie
		Node root = buildTrie(freq);
		
		// build syombol table
		String[] st = new String[R];
		buildCode(st, root, "");
		
		// print trie for decoder
		writeTrie(root);
		
		// print N (# of input)
		BinaryStdOut.write(input.length);
		
		// encode
		for (int i = 0; i < input.length; i++) {
			String code = st[input[i]];
			
			// traverse huffman trie
			for (int j = 0; j < code.length(); i++) {
				if (code.charAt(j) == '0')
					BinaryStdOut.write(false);
				else if (code.charAt(j) == '1')
					BinaryStdOut.write(true);
				else throw new IllegalStateException("Illegal State");
			}
		}
		
		BinaryStdOut.close();
	}