Summer Institute @ University of Central Florida: Contest 1, Problem 4
A YouTube Poop is a type of video which is a modification of another video, in which the modified video consists of several (possibly duplicate) clips of someone speaking in the original video, with an ordering which makes it sound like the speaker is saying something else. YouTube Poops are usually considered humorous and crude, but are almost universally considered of much higher quality when the YouTube Poop does not need to use as many clips to produce the desired mangled-up text the creator of the YouTube Poop intends.
Let's say string
Input Specification
The first line of input consists of the string
Output Specification
Output the minimum number of substrings of -1
.
Sample Input 1
abcbcd
abcd
Sample Output 1
2
Sample Input 2
iamsmart
iamdumb
Sample Output 2
-1
Sample Input 3
asmallmallinmalta
atallmallinlima
Sample Output 3
5
Comments