#include<iostream> #include<string.h> using namespace std; int main() { string s; while (cin >> s) { int* k; k = new int[s.size()]; int i, j; for (i = 0; i < s.size(); i++)k[i] = 0; //给标志向量赋初值 i = 0; int flag;//用于标记是否存在重复的字符 while (i < s.size()) { if (k[i] == 0) { k[i] = 1; j = i + 1; flag = 0; while (j < s.size()) { if (s[i] == s[j] && flag == 0) { cout << s[i] << ":" << i; cout << "," << s[j] << ":" << j; flag = 1; k[j] = 1; } else if (s[i] == s[j] && flag == 1) { cout << "," << s[j] << ":" << j; k[j] = 1; } j++; } if (flag == 1)cout << endl; } i++; } } return 0; }