#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <map> #include <vector> using namespace std; map<char, vector<int>>hashmap; int main() { char a[100]; while (scanf("%s", a) != EOF) { for (int i = 0; a[i] != '\0'; i++) { hashmap[a[i]].push_back(i); } for (int i = 0; a[i] != '\0'; i++) { if (hashmap[a[i]].size() > 1 && hashmap[a[i]][0] != 9999) { printf("%c:%d", a[i], hashmap[a[i]][0]); for (int j = 1; j < hashmap[a[i]].size(); j++) { printf(",%c:%d", a[i], hashmap[a[i]][j]); } hashmap[a[i]][0] = 9999; printf("\n"); } } } return 0; }