//1.统计字母
//2.判断是否重复
//3.找到下一个重复项的位置
#include<iostream>
#include<algorithm>
#include<string>
#include<map>

using namespace std;

struct Mark {
    int count; //重复个数
    int flag;  //判断是否重复
};

map<char, Mark> M;

int main()
{
    string Str;
    int Next[1005];
    while (cin >> Str) {
        for (int i = 0; i < Str.size(); i++) {
            M[Str[i]].count++;
            M[Str[i]].flag++;
        }
        for (int i = 0; i < Str.size(); i++) {
            for (int j = i + 1; j < Str.size(); j++) {
                if (Str[i] == Str[j]) {
                    Next[i] = j; //记录下一个相同项位置。
                    break;
                }
            }
        }
        for (int i = 0; i < Str.size(); i++) {
            int temp = i;
            int flag = 0;
            while (M[Str[temp]].count && M[Str[temp]].flag >= 2) {
                cout << Str[temp] << ":" << temp;
                M[Str[temp]].count--;
                if (M[Str[temp]].count != 0) {
                    cout << ",";
                }
                temp = Next[temp];
                flag = 1; 
            }
            if (flag == 1) {
                cout << endl;
            }
        }
    }
}