본문 바로가기

Algorithm

C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 2789번:유학 금지 답

반응형
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include <string>
using namespace std;
string a, b="CAMBRIDGE";
int main() {
    cin >> a;
    for(int i =0; i<a.size(); i++)
        for(int j =0; j<b.size();j++)
            if (a[i] == b[j]) { a[i] = 0; }
    for (int i = 0; i < a.size(); i++)
        if (a[i] != 0)cout << a[i];
}
cs