public class Day1_ClassTest2 {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
char[] ch = s.toCharArray();
TreeMap<Character, Integer> tm = new TreeMap<>();
for (char c : ch) {
if((c>='A'&&c<='Z')||(c>='a'&&c<='z')){
if(tm.containsKey(c)){
tm.put(c, tm.get(c)+1);
}else{
tm.put(c, 1);
}
}
}
Set<Character> st = tm.keySet();
for (Character cha : st) {
System.out.print(cha+"("+tm.get(cha)+")");
}
public class Day1_ClassTest2 {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c >= 'a' && c <= 'z' || c <= 'Z' && c >= 'A') {
sb.append(c);
}
}
s = new String(sb);
for (int i = 0; i < s.length();) {
int a = s.length();
char[] ch = new char[1];
ch[0] = s.charAt(0);
s = s.replace(new String(ch), "");
System.out.print(ch[0] + "(" + (a - s.length()) + ")");
}