12345678910111213141516171819202122232425 |
- #include <stdio.h>
- #include <string.h>
- int main() {
- int count = 0;
- int pos1, pos2;
- char target;
- char str[100];
- while (scanf("%d-%d %c: %s", &pos1, &pos2, &target, str) == 4) {
- pos1--; pos2--;
- int char_count = 0;
- if (str[pos1] == target)
- char_count++;
- if (str[pos2] == target)
- char_count++;
- if (char_count == 1)
- count++;
- }
- printf("%d\n", count);
- return 0;
- }
|