String s="mmababctamantlslwgikl";
int distinct = 0 ;
while(s.length()>0){
for (int j = 0; j < s.length(); j++) {
if(s.charAt(0)==s.charAt(j))
{
distinct++;
}
}
System.out.println(s.charAt(0)+"--"+distinct);
String d=String.valueOf(s.charAt(0)).trim();
s=s.replaceAll(d,"");
distinct = 0;
}