fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main() {
  5.  
  6. int cnt = 0;
  7.  
  8. char str[101];
  9. scanf("%s", str);
  10.  
  11. char croa[8][4] = {"c=", "c-", "dz=", "d-", "lj", "nj", "s=", "z="};
  12.  
  13. int len = strlen(str);
  14.  
  15. for (int i = 0; i < len; i++) {
  16. int tmp = 0;
  17. for (int j = 0; j < 8; j++) {
  18. if (str[i] == croa[j][0]) {
  19. if (j == 2) {
  20. if ((str[i+1] == croa[j][1]) && (str[i+2] == croa[j][2])) {
  21. cnt++;
  22. i += 2;
  23. tmp = 1;
  24. break;
  25. }
  26. }
  27. if (str[i+1] == croa[j][1]) {
  28. cnt++;
  29. i++;
  30. tmp =1;
  31. break;
  32. }
  33. }
  34. }
  35. if (tmp == 0)
  36. cnt++;
  37. }
  38. printf("%d", cnt);
  39.  
  40. return 0;
  41. }
Success #stdin #stdout 0.01s 5280KB
stdin
dz=dz
stdout
2