import java.util.*;
class Maptest3
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
sop("请输入要判断的字符串:");
String s = sc.next();
TreeMap<String,Integer> hm =new TreeMap<String,Integer>();
for(int x=0;x<s.length();x++)
{
String str = String.valueOf(s.charAt(x));
if (hm.get(str)==null)
{
hm.put(str,1);
}
else
hm.put(str,(hm.get(str)+1));
}
Set<String> keySet = hm.keySet();
Iterator<String> it =keySet.iterator();
while(it.hasNext())
{
String str = it.next();
Integer i = hm.get(str);
sop(str+"("+String.valueOf(i)+")");
}
}
public static void sop(Object obj)
{
System.out.println(obj);
}
}
class paixu implements Comparator<String>
{
public int compare(String s1,String s2)
{
return s2.compareTo(s1);
}
}