Skip to content

Instantly share code, notes, and snippets.

@HyeonWooKim
Created March 23, 2016 19:25
Show Gist options
  • Save HyeonWooKim/1fab2d09700e2601363b to your computer and use it in GitHub Desktop.
Save HyeonWooKim/1fab2d09700e2601363b to your computer and use it in GitHub Desktop.
문자열 폭발(BOJ 9935)
#include<iostream>
#include<string>
using namespace std;
int main()
{
string s, t, r;
int l,n,m=0;
cin >> s >> t;
l=s.length(),n=t.length();
r.resize(s.length());
for (int i=0; i<l; i++)
{
r[m++] = s[i];
if (m >= n)
{
int j=0;
for (; j<n; j++)
if(r[j+m-n]!=t[j])break;
if (j==n) m-=n;
}
}
r.resize(m);
cout<<(m?r:"FRULA");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment