Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- 이웃한 칸
- 프로그래머스
- 모의 주식
- SNS
- 빅데이터
- 코스닥
- 자바
- java
- 풀스택프레임워크
- 프로그램
- 자바독학
- 코테
- C++
- frontend
- 코딩독학
- 사물인터넷
- Reflex
- 개발자
- 개인프로젝트
- backend
- 코딩
- 백준
- 코딩테스트
- Project
- Python
- 자바정리
- 개발
- 프로그래밍
- 주가예측
- java정리
Archives
- Today
- Total
Creative Code
[9935번]문자열 폭발 본문
https://www.acmicpc.net/problem/9935
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
vector<char>s;
string str, bomb;
cin >> str >> bomb;
string answer = "";
for (int i = 0; i < str.size(); i++) {
s.push_back(str[i]);
if (s.size() >= bomb.size()) {
bool check = true;
for (int j = 0; j < bomb.size(); j++) {
if (s[s.size() - bomb.size() + j] != bomb[j]) {
check = false;
}
}
if (check == true) {
for (int j = 0; j < bomb.size(); j++) {
s.pop_back();
}
}
}
}
if (s.empty()) {
cout << "FRULA";
}
else {
for (int i = 0; i < s.size(); i++) {
answer += s[i];
}
cout << answer;
}
}
'백준 문제풀이' 카테고리의 다른 글
[14502번]연구소 (0) | 2023.09.24 |
---|---|
[14500번]테트로미노 (0) | 2023.09.24 |
[9663번]N-Queen (0) | 2023.09.24 |
[9019번]DSLR (0) | 2023.09.24 |
[7662번]이중 우선순위 큐 (0) | 2023.09.24 |