Danganronpa is a video game franchise created and developed by Spike Chunsoft, the series' name is compounded from the Japanese words for "bullet" (dangan) and "refutation" (ronpa).
Now, Stilwell is playing this game. There are
n verbal evidences, and Stilwell has
m "bullets". Stilwell will use these bullets to shoot every verbal evidence.
Verbal evidences will be described as some strings
Ai, and bullets are some strings
Bj. The damage to verbal evidence
Ai from the bullet
Bj is
f(Ai,Bj).
f(A,B)=∑i=1|A|−|B|+1[ A[i...i+|B|−1]=B ]
In other words,
f(A,B) is equal to the times that string
B appears as a substring in string
A.
For example:
f(ababa,ab)=2,
f(ccccc,cc)=4Stilwell wants to calculate the total damage of each verbal evidence
Ai after shooting all
m bullets
Bj, in other words is
∑mj=1f(Ai,Bj).