public static void check_ans(ArrayList<String> stream, int k, ArrayList<String> items) {
    Collections.sort(stream);
    Collections.sort(items);
    
    int count = 1, idx = 0;
    for (int i = 1; i < stream.size(); ++i) {
      if (stream.get(i).compareTo(stream.get(i - 1)) != 0) {
        if (new Double(count) >= 1.0*stream.size() / k) {
          assert(idx < items.size());
          assert(stream.get(i - 1).compareTo(items.get(idx++)) == 0);
        }
        count = 1;
      } else {
        ++count;
      }
    }
    if (new Double(count) >= 1.0*stream.size() / k) {
      assert(stream.get(stream.size() - 1).compareTo(items.get(idx++)) == 0);
    }
    assert(idx == items.size());
  }