哈希+两次遍历 #include <stdio.h> typedef struct { char flag; char len; char pos[98]; } zifu; int main() { char a[101]; while (scanf("%s", a) != EOF) { zifu lst[128]; memset(lst, 0, sizeof(lst)); for (int i = 0; a[i] != '\0'; i++) { lst[a[i]].pos[lst[a[i]].len] = i; lst[a[i]].len++; } for (int i = 0;...