티스토리 뷰

뭔 생각이 부족해서 못 풀었나

기본적인 구현아이디어는 모두 생각해냈다.

 

뭘 실수해서 틀렸나

하지만 인덱스를 지정된 크로아티아 알파벳만큼 옮겨줄때 size - 1 인거를 그때에는 헷갈림

 

그래서 뭘 기억하면 되나

위에 말한 것들.

 

#include <iostream>
#include <vector>
using namespace std;

int main(){
    cin.tie(0) -> sync_with_stdio(0);
    vector<string> arr = {"c=", "c-", "dz=", "d-" , "lj", "nj", "s=", "z="};

    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 0; i < s.size(); i++){
        bool found = false;

        for (string str : arr){
            if (s.substr(i, str.size()) == str){
                i += str.size() - 1;
                found = true;
                cnt++;
                break;
            }
        }
        //if (!found){
            //cnt++;
        //}
       
    }

    cout << cnt;


}
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/11   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
글 보관함