Created
March 23, 2016 19:25
-
-
Save HyeonWooKim/1fab2d09700e2601363b to your computer and use it in GitHub Desktop.
문자열 폭발(BOJ 9935)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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