43 lines
516 B
C
43 lines
516 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
|
|
char c[15];
|
|
int mask = 0;
|
|
|
|
int is_equal () {
|
|
int j = 0;
|
|
mask = 0;
|
|
for (j=0; j<14; j++){
|
|
int n = c[j] - 'a';
|
|
if (mask & (1 << n))
|
|
return 0;
|
|
mask |= (1<<n);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
int main () {
|
|
int k = 0;
|
|
int j = 1;
|
|
char f;
|
|
c[15] = 0;
|
|
while (j < 5) {
|
|
c[k] = getchar();
|
|
k++;
|
|
j++;
|
|
}
|
|
|
|
while ((f = getchar()) != EOF) {
|
|
k %=14;
|
|
printf("%d %s f:%c\n",k,c,f);
|
|
if (is_equal()) break;
|
|
c[k] = f;
|
|
k++;
|
|
j++;
|
|
}
|
|
printf("%d\n", j-1);
|
|
|
|
}
|