![]() |
||||||||||
|
||||||||||
Family ViewTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 5286 Accepted Submission(s): 1043 Problem Description Steam is a digital distribution platform developed by Valve Corporation offering digital rights management (DRM), multiplayer gaming and social networking services. A family view can help you to prevent your children access to some content which are not suitable for them. Take an MMORPG game as an example, given a sentence T, and a list of forbidden words {P}, your job is to use '*' to subsititute all the characters, which is a part of the substring matched with at least one forbidden word in the list (case-insensitive). For example, T is: "I love Beijing's Tiananmen, the sun rises over Tiananmen. Our great leader Chairman Mao, he leades us marching on." And {P} is: {"tiananmen", "eat"} The result should be: "I love Beijing's *********, the sun rises over *********. Our gr*** leader Chairman Mao, he leades us marching on." Input The first line contains the number of test cases. For each test case: The first line contains an integer $n$, represneting the size of the forbidden words list $P$. Each line of the next $n$ lines contains a forbidden words $P_i~(1\le |P_i|\le 1000000, \sum |P_i| \le 1000000)$ where $P_i$ only contains lowercase letters. The last line contains a string $T~(|T| \le 1000000)$. Output For each case output the sentence in a line. Sample Input
Sample Output
Source | ||||||||||
|