#include #include int main() { char *line = 0; size_t len; ssize_t nlen = getline(&line, &len, stdin); int distinctChars = 4; for (int i = distinctChars -1; i < nlen; i++) { int isTwoEqual = 0; for (int ii = 0; ii < distinctChars; ii++) { for (int iii = 0; iii < distinctChars; iii++) { if (ii == iii) continue; isTwoEqual |= (line[i-ii] == line[i-iii]); } } if ( !isTwoEqual ) { printf("%d\n", i+1); return 0; } } }