갓비니

★★백준 7단계 2941 크로아티아 알파벳 C++ / vector 본문

Programming/코딩 문제 풀이

★★백준 7단계 2941 크로아티아 알파벳 C++ / vector

갓비니 2020. 4. 23. 02:38

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <string>
#include<vector>
using namespace std;
 
int main() {
    vector <string> V = { "c=""c-""dz=""d-""lj""nj""s=""z=" };
    string croatia;
    int index=0;
 
    cin >> croatia;
 
    for (int i = 0; i < V.size(); i++) {
        for (; index != string::npos; index=croatia.find(V[i])) {
            croatia.replace(index, V[i].length(), "X");
        }
    }
    cout << croatia.length();
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter