스택
-
스택 응용, 백준 9935: 문자열 폭발알고리즘 2024. 3. 5. 11:47
#include #include #include using namespace std; int main(int argc, const char * argv[]) { ios::sync_with_stdio(false); cin.tie(NULL); stack stack; string str, bomb; cin >> str >> bomb; int strSize = str.size(); int bombSize = bomb.size(); char bombEnd = bomb[bombSize - 1]; for (int i = 0; i < strSize; i++) { char c = str[i]; stack.push(c); if ( c == bombEnd ) { if( stack.size() < bombSize ) cont..