https://www.acmicpc.net/problem/2941
Code
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int main(void) {
char arr[101] = { NULL, };
int cnt = 0;
gets(arr);
for (int i = 0; i < strlen(arr); i++) {
for (int j = i + 2; j >= i; j--) {
if (j == i + 2) {
if (arr[j - 2] == 'd' && arr[j - 1] == 'z' && arr[j] == '=') {
cnt++;
i += 2;
continue;
}
}
if (j == i + 1) {
if (arr[j - 1] == 'c' && arr[j] == '=') {
cnt++;
i += 1;
continue;
}
if (arr[j - 1] == 'c' && arr[j] == '-') {
cnt++;
i += 1;
continue;
}
if (arr[j - 1] == 'd' && arr[j] == '-') {
cnt++;
i += 1;
continue;
}
if (arr[j - 1] == 'l' && arr[j] == 'j') {
cnt++;
i += 1;
continue;
}
if (arr[j - 1] == 'n' && arr[j] == 'j') {
cnt++;
i += 1;
continue;
}
if (arr[j - 1] == 's' && arr[j] == '=') {
cnt++;
i += 1;
continue;
}
if (arr[j - 1] == 'z' && arr[j] == '=') {
cnt++;
i += 1;
continue;
}
}
if(j == i) {
cnt++;
continue;
}
}
}
printf("%d", cnt);
return 0;
}