All submissions for this problem are available.
Give a string s of length l, and a set S of n sample string(s). We do reduce the string s using the set S by this way:
- Wherever Si appears as a consecutive substring of the string s, you can delete (or not) it.
- After each deletion, you will get a new string s by joining the part to the left and to the right of the deleted substring.
By that way, try to reduce the given string s to get a new string of minimum length. You can do delete for unlimited times.
- The first line contains the string s.
- The second line contains the integer n.
- Within the last n lines, the i-th line contains the string Si.
Output on a single line an integer which is the minimum length found.
aaabccd 3 abc ac aaa
|Tags||anhdq, hard, oct10|
|Time Limit:||0.3 - 0.345555 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, kotlin, PERL6, TEXT, CPP17, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.