Under construction

Still being built. Things may change

Slice String

Time limit1sMemory limit1024 MB

Summary
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 NN character delimiters, MM digit delimiters, KK mergers, the length SS 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 NN. (1≤N≤1 000)(1 \le N \le 1\,000)

The second line contains the NN character delimiters, separated by spaces.

The third line contains the number of digit delimiters MM. (1≤M≤1 000)(1 \le M \le 1\,000)

The fourth line contains the MM digit delimiters, separated by spaces.

The fifth line contains the number of mergers KK. (1≤K≤1 000)(1 \le K \le 1\,000)

The sixth line contains the KK mergers, separated by spaces.

The seventh line contains the length of the target string SS. (1≤S≤1 000)(1 \le S \le 1\,000)

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.

Examples3

  1. Example 1

    Input
    2
    a b
    1
    3
    1
    a
    12
    abcdefg 1234
    
    Expected output
    a
    cdefg
    12
    4
    
  2. Example 2

    Input
    1
    a
    1
    1
    2
    1 a
    5
    1abcd
    
    Expected output
    1abcd
    
  3. Example 3

    Input
    3
    b c d
    1
    1
    1
    e
    6
    abcde1
    
    Expected output
    a
    e