fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4.  
  5. int main(){
  6. int c = 0;
  7. scanf("%d", &c);
  8.  
  9. int count = 0;
  10.  
  11. for(int i = 0; i < c; i++){
  12. char s[100005] = {NULL};
  13. scanf("%s", &s);
  14.  
  15. int len = strlen(s);
  16.  
  17. bool check = 1;
  18. if(len % 2 == 0) { // 단어의 길이가 홀수라면 애초에 '좋은 단어'가 아니다(예제 2 참조)
  19. for(int i = 0; i < len; i++){
  20. if(s[i] != s[len - i - 1]) check = 0;
  21. }
  22. if(check) {
  23. count++;
  24. }
  25. }
  26. }
  27. printf("%d", count);
  28. return 0;
  29. }
Success #stdin #stdout 0s 5316KB
stdin
3
ABAB
AABB
ABBA
stdout
1