#include <stdio.h> int main() { char C[100] = {' '}; int inx = 0; scanf("%s", &C); while(C[inx] != '\0'){ inx++; } int A[100] = { 0 }; for (int i = 0; i < inx; i++) { //实现不重复打印 int flag1 = 0; for (int t = i-1; t >= 0; t--) { if (C[t] == C[i]) { flag1 = 1; } } if (flag1 == 1) continue; // int count[100] = { 0 }; int flag2 = 0;//用于判断是否有一样的数 int count1 = 0; for (int j = i+1; j < inx; j++) { if (i == j) continue; if (C[i] == C[j]) { count[count1] = j; count1++; flag2 = 1; } } if (flag2 == 1) { printf("%c:%d,", C[i], i); for (int q = 0; q < count1; q++) { printf("%c:%d", C[i], count[q]); if (q != count1-1) { printf(","); } } printf("\n"); } } return 0; }