https://www.acmicpc.net/problem/1316
Code
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int main(void) {
char arr[101][101] = { NULL, };
int n;
int cnt = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%s", arr[i]);
}
for (int i = 0; i < n; i++) {
int flag = 0;
int alpha[27] = { 0, };
for (int j = 0; j < strlen(arr[i]); j++) {
if (alpha[arr[i][j] - 97] == 0) {
flag++;
}
else if (alpha[arr[i][j] - 97] != 0 && arr[i][j] != arr[i][j - 1]) {
flag = -1;
break;
}
alpha[arr[i][j] - 97]++;
}
if (flag > -1) {
cnt++;
}
}
printf("%d", cnt);
return 0;
}