34 lines
468 B
C
34 lines
468 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
|
|
char c[5];
|
|
|
|
int is_equal () {
|
|
return !(c[0] == c[1] || c[0] == c[2] || c[0] == c[3] || c[1] == c[2] || c[1] == c[3] || c[2] == c[3]);
|
|
}
|
|
|
|
int main () {
|
|
int k = 0;
|
|
int j = 1;
|
|
char f;
|
|
c[5] = 0;
|
|
while (j < 5) {
|
|
c[k] = getchar();
|
|
k++;
|
|
j++;
|
|
}
|
|
|
|
while ((f = getchar()) != EOF) {
|
|
k %=4;
|
|
printf("%d %s f:%c\n",k,c,f);
|
|
if (is_equal()) break;
|
|
c[k] = f;
|
|
k++;
|
|
j++;
|
|
}
|
|
printf("%d\n", j-1);
|
|
|
|
}
|