fork download
  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. using namespace std;
  5.  
  6. int main (void) {
  7. int num;
  8. int index = 0;
  9. char word[100] = {0, };
  10. int count = 0;
  11.  
  12. scanf("%d", &num);
  13.  
  14. for (int i = 0; i < num; ++i) {
  15. //printf("i[%d], num[%d]\n", i, num);
  16. bool number[26] = {0, };
  17. bool sequence = false;
  18. scanf("%s", word);
  19. for(int j = 0; word[j] != '\0'; ++j) {
  20. index = word[j] - 97;
  21. //printf("index : %d\n", index);
  22. if(number[index] == true) {
  23. if (j > 0 && word[j] == word[j-1])
  24. sequence = true;
  25. else
  26. sequence = false;
  27. } else {
  28. number[index] = true;
  29. sequence = true;
  30. }
  31. }
  32. if(sequence == true){
  33. //printf("%s\n", word);
  34. count++;
  35. }
  36. }
  37.  
  38. printf("%d", count);
  39.  
  40. return 0;
  41. }
Success #stdin #stdout 0s 4212KB
stdin
1
abaa
stdout
1