근본없는 코딩
[C++] 백준2941 크로아티아 알파벳 본문
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
char str[101];
int cnt = 0;
cin >> str;
for (int i = 0; i < 101; i++) {
if (str[i] == '\0') break;
if (((str[i] == 'c' || str[i] == 'd') && str[i + 1] == '-')
|| ((str[i] == 'l' || str[i] == 'n') && str[i + 1] == 'j')
|| ((str[i] == 'c' || str[i] == 's' || str[i] == 'z') && str[i + 1] == '=')) {
cnt++;
i++;
}
else if (str[i] == 'd' && str[i + 1] == 'z' && str[i + 2] == '=') {
cnt++;
i += 2;
}
else cnt++;
}
cout << cnt << '\n';
return 0;
}
'✔ Online Judge' 카테고리의 다른 글
[C++] 백준25206 너의 평점은 (0) | 2023.06.29 |
---|---|
[C++] 백준1316 그룹 단어 체커 (0) | 2023.06.29 |
[C++] 백준4344 평균은 넘겠지 (0) | 2023.06.29 |
[C++] 백준1157 단어공부 (0) | 2023.06.29 |
[C++] 백준10988 팰린드롬인지 확인하기 (0) | 2023.06.29 |