#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
string str;
cin >> str;
vector<string> v = {{"c="}, {"c-"}, {"dz="}, {"d-"}, {"lj"}, {"nj"}, {"s="}, {"z="}};
int alphabetCnt = 0;
int wordIdx = 0;
while (wordIdx < str.size()) {
for (int i = 0; i < v.size(); i++) {
if (str.substr(wordIdx, v[i].size()) == v[i]) {
alphabetCnt++;
wordIdx += v[i].size();
break;
}
if (i == v.size() - 1) {
wordIdx++;
alphabetCnt++;
}
}
}
cout << alphabetCnt << '\n';
return 0;
}
문제 :
'문제풀이 > 백준' 카테고리의 다른 글
2839 - 설탕 배달 (0) | 2021.08.24 |
---|---|
1712 - 손익분기점 (0) | 2021.08.24 |
5622 - 다이얼 (0) | 2021.08.24 |
1152 - 단어의 개수 (0) | 2021.08.24 |
1157 - 단어 공부 (0) | 2021.08.24 |