Skip to content

Commit

Permalink
2024-04-04 문자열 폭발
Browse files Browse the repository at this point in the history
  • Loading branch information
InSange committed Apr 4, 2024
1 parent caf12e0 commit fefcebc
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
3 changes: 2 additions & 1 deletion InSange/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
| 3차시 | 2024.03.19 | 플로이드 워셜 | [](https://www.acmicpc.net/problem/7579) | [#3](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/9) |
| 4차시 | 2024.03.25 | 다익스트라 | [파티](https://www.acmicpc.net/problem/1238) | [#4](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/15)|
| 5차시 | 2024.03.27 | DP | [RGB거리2](https://www.acmicpc.net/problem/17404) | [#5](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/19)]
| 6차시 | 2024.04.01 | 최소신장트리 | [행성 터널](https://www.acmicpc.net/problem/2887) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/19)]
| 6차시 | 2024.04.01 | 최소신장트리 | [행성 터널](https://www.acmicpc.net/problem/2887) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/24)]
| 7차시 | 2024.04.04 | 스택 | [문자열 폭발](https://www.acmicpc.net/problem/9935) | [#7](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/19)]
=======
---
54 changes: 54 additions & 0 deletions InSange/스택/9935.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include <iostream>

using namespace std;

string s, boom;
int blen;

void Solve()
{
cin >> s >> boom;

blen = boom.length();

string st = "";
for (char c : s)
{
st.push_back(c);

if (c == boom[blen-1] && st.size() >= blen)
{
bool flag = true;

for (int i = 0; i < blen; i++)
{
if (boom[i] != st[st.length() - blen + i])
{
flag = false;
break;
}
}

if (flag)
{
for (int i = 0; i < blen; i++)
{
st.pop_back();
}
}
}
}

if (st == "") cout << "FRULA";
else cout << st;
}

int main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);

Solve();

return 0;
}

0 comments on commit fefcebc

Please sign in to comment.