#include<iostream> #include<string.h> using namespace std; typedef struct { char x; int num; }S; void binarysearch(S *a,int n) { int i, j; for ( i = 0; i < n; i++) { int tag = 0; for ( j = i+1; j < n; j++) { if (a[j].x == a[i].x) { a[j].num = j; if (tag == 0) { tag = 1; a[i].num = i; } } } } } int main() { S s[100]; string k; while (cin >> k) { int n = size(k); for (int i = 0; i <n; i++) { s[i].x = k[i]; s[i].num = -1; } binarysearch(s,n); for (int i = 0; i < n; i++) { int tag = 0; for (int j = i + 1; j < n; j++) { if (s[j].num != -1&&s[i].x==s[j].x) { if (tag == 0) { cout << s[i].x << ":" << s[i].num; tag = 1; } cout<<","<< s[j].x << ":" << s[j].num; s[j].num = -1; } } if (tag == 1) { cout << endl; } } } return 0; }