Slice String
Time limit1sMemory limit1024 MB
Given character and digit delimiters, mergers that exempt characters from splitting, and a string, print the pieces left after splitting on spaces and delimiters.
- Level
Easy3 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
Ims, who likes strings, made a new string game.
The game uses a delimiter, the criterion for splitting a string, and a merger, a condition that excludes a character from being a delimiter. The rules are as follows.
- This game splits a string by the rules below.
- The string is split by spaces and the given delimiters.
- Each character delimiter is one English letter, uppercase or lowercase.
- Each digit delimiter is one digit from 0 to 9.
- Characters given as mergers are not treated as delimiters.
- Each merger is one English letter or one digit from 0 to 9.
- Delimiters and mergers each consist of one character.
- The target string consists of English letters, digits, and spaces.
- The same delimiter or merger may be given more than once.
Given character delimiters, digit delimiters, mergers, the length of the target string, and the target string, print the result of applying these rules.
Input
The first line contains the number of character delimiters .
The second line contains the character delimiters, separated by spaces.
The third line contains the number of digit delimiters .
The fourth line contains the digit delimiters, separated by spaces.
The fifth line contains the number of mergers .
The sixth line contains the mergers, separated by spaces.
The seventh line contains the length of the target string .
The eighth line contains the target string.
Output
Print the result of applying the rules, one result per line.
The result is never an empty string.