Add this on to the end of it:
var array = $("#hidAll").html();
x = array.split(',');
key=s="";
for (i=0; i<x.length; i++) {
oldkey = key;
key = x[i].split('|')[0];
if (oldkey==key) s+='!';
else s+=',\n'+key+'|';
s+=x[i].split('|')[1];
}
s = s.substring(1);
$('#hidAll').html(a);