public void map(LongWritable key, Text values, Context context) throws IOException, InterruptedException {
        String item = null;
        String value = null;
        Map<String, String> listresults = new HashMap<String, String>();
        String[] splits = values.toString().split("\n");
        for (String val : splits){

            if (val.split("\t").length ==3) {
                item = val.split("\t")[1];
                value = val.split("\t")[2];
            }
            else if(val.split("\t").length ==2){
                item = val.split("\t")[0];
                value = val.split("\t")[1];
            }
            if (listresults.get(item) != null){
                long oldvalue = Long.valueOf(listresults.get(item));
                String newvalue = String.valueOf(oldvalue + Long.valueOf(value));
                listresults.put(item,newvalue);
                listresults.put(item,newvalue);
            }
            else{
                listresults.put(item,value);
            }
        }
        for (String i : listresults.keySet()){
            newkey.set(key.toString());
//            result.set(String.valueOf("pattern" +"\t"+ i + "\t" + listresults.get(i)));
            result.set(String.valueOf(i + "\t" + listresults.get(i)));
            context.write(newkey, result);
        }
    }