p03751 square869120Contest #4 - Atcoder Handles_9790
Mr.X, who the handle name is T, looked at the list which written N handle names, S_1, S_2, ..., S_N.
But he couldn't see some parts of the list. Invisible part is denoted `?`.

Please calculate all possible index of the handle name of Mr.X when you sort N+1 handle names (S_1, S_2, ..., S_N and T) in lexicographical order.
Note: If there are pair of people with same handle name, either one may come first.

Input

The input is given from standard input in the following format.



N
S_1
S_2
:
S_N
T


Output

* Calculate the possible index and print in sorted order. The output should be separated with a space. Don't print a space after last number.
* Put a line break in the end.



Constraints

* 1 ≤ N ≤ 10000
* 1 ≤ |S_i|, |T| ≤ 20 (|A| is the length of A.)
* S_i consists from lower-case alphabet and `?`.
* T consists from lower-case alphabet.



Scoring

Subtask 1 [ 130 points ]

* There are no `?`'s.



Subtask 2 [ 120 points ]

* There are no additional constraints.

Output

* Calculate the possible index and print in sorted order. The output should be separated with a space. Don't print a space after last number.
* Put a line break in the end.



Constraints

* 1 ≤ N ≤ 10000
* 1 ≤ |S_i|, |T| ≤ 20 (|A| is the length of A.)
* S_i consists from lower-case alphabet and `?`.
* T consists from lower-case alphabet.



Scoring

Subtask 1 [ 130 points ]

* There are no `?`'s.



Subtask 2 [ 120 points ]

* There are no additional constraints.

Input

The input is given from standard input in the following format.



N
S_1
S_2
:
S_N
T

Example

Input

2
tourist
petr
e


Output

1
//-----------------------------------------------------------
// すぐ使える
//-----------------------------------------------------------
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
		// 1行目数字、2行目文字
		int N = Integer.parseInt(br.readLine());
		String s;
		String[] S = new String[N+1];
		String[] Sa = new String[N+1];
		String[] Sz = new String[N+1];
		for(int i=0; i<N; i++) { 
			s = br.readLine();
			S[i] = s;
			Sa[i] = s.replace('?', 'a') + '5';
			Sz[i] = s.replace('?', 'z') + '5';
		}
		String T = br.readLine();
		Sa[N] = T + '0';
		Sz[N] = T + '9';

//		Arrays.sort(S);
		Arrays.sort(Sa);
		Arrays.sort(Sz);

		int min=0;
		int max=0;

					//入力値確認
					for(int i=0; i < Sa.length; i++){
						//System.out.println(Sa[i]);
					}
					for(int i=0; i < Sz.length; i++){
						//System.out.println(Sz[i]);
					}

		for(int i=0; i < Sa.length; i++){
			if(Sa[i].equals(T+'0')){ min = i+1; break; }
		}
		for(int i=0; i < Sz.length; i++){
			if(Sz[i].equals(T+'9')){ max = i+1; break; }
		}
		
		//System.out.println("min=["+min+"], max=["+max+"]");
		if(min>max) {
			int i = min;
			min = max;
			max = i;
		}
		//System.out.println("min=["+min+"], max=["+max+"]");

		StringBuilder sb = new StringBuilder();
		for(int i=min; i <= max; i++){
			sb.append(i);
			if (i == max) {
				//sb.append(System.getProperty("line.separator"));
			} else {
				sb.append(" ");
			}
		}
		System.out.println(sb);

        //System.out.println(iCount + " " + s);
        return;
    }
    //-----------------------------------------------------------------
    // Debug.Print
    static void dp(String s) {
		System.out.println(s);
	}
    static void dp(StringBuilder s) { dp(s.toString()); }
    static void dp(int i) { dp(String.valueOf(i)); }
    static void dp(long i) { dp(String.valueOf(i)); }


	//-----------------------------------------------------------------
	// 入力値確認：リスト
	static void checkInput(List l) { System.out.println(l); }
	//-----------------------------------------------------------------
	// 入力値確認：配列、1次元、float型
	//   ＜使い方＞
	//     float[] f = new float[N];
	//     checkInput(f);
	static void checkInput(float[] i1) {
		StringBuilder sb = new StringBuilder();
		for(float i: i1) sb.append("[" + i + "]");
		System.out.println(sb);
	}
	//-----------------------------------------------------------------
	// 入力値確認：配列、1次元、int型
	//   ＜使い方＞
	//     int[] c = new int[N];
	//     checkInput(c);
	static void checkInput(int[] i1) {
		StringBuilder sb = new StringBuilder();
		for(int i: i1) sb.append("[" + i + "]");
		System.out.println(sb);
	}
	//-----------------------------------------------------------------
	// 入力値確認：配列、二次元、int型
	static void checkInput(int[][] i2) {
		StringBuilder sb = new StringBuilder();
		for(int[] i1: i2){
			for(int i: i1) sb.append("[" + i + "]");
			sb.append(System.getProperty("line.separator"));
		}
		System.out.println(sb);
	}
	//-----------------------------------------------------------------
	// 入力値確認：配列、二次元、int型
	static void checkInput(long[][] i2) {
		StringBuilder sb = new StringBuilder();
		for(long[] i1: i2){
			for(long i: i1) sb.append("[" + i + "]");
			sb.append(System.getProperty("line.separator"));
		}
		System.out.println(sb);
	}

}

//-----------------------------------------------------------
//-----------------------------------------------------------

2
tourist
petr
e 2
tourist
eptr
e 2
ssvuhnr
errs
f 2
hupouvt
etor
i 2
sourist
eptr
e 2
sourist
eqtr
e 2
sourist
etqr
e 2
sourisu
etqr
e 2
sourisu
etqr
d 2
sourisu
etrr
d 2
sourisu
rrte
d 2
souuisr
rrte
d 2
ssuuior
rrte
d 2
ssuuior
srte
d 2
ssuuior
etrs
d 2
ssvuior
etrs
d 2
ssvuior
etss
d 2
ssvuior
sste
d 2
ssvuior
sste
e 2
ssvuior
sset
e 2
ssvuior
sset
f 2
ssvuior
tses
f 2
ssvuior
sses
f 2
ssvuhor
sses
f 2
ssvuhor
sres
f 2
ssvuhor
sers
f 2
ssvuhor
rers
f 2
ssvuhnr
rers
f 2
rnhuvss
errs
f 2
rnhuvss
srre
f 2
rnguvss
srre
f 2
vngurss
srre
f 2
vngurss
srre
e 2
nvgurss
srre
e 2
gvnurss
srre
e 2
ssrunvg
srre
e 2
ssrunug
srre
e 2
ssrunug
srre
d 2
ssrunug
errs
d 2
ssrunug
drrs
d 2
ssrunug
drrs
e 2
ssrunug
srrd
e 2
ssrunug
srrd
f 2
rsrunug
srrd
f 2
rsrunug
srrd
e 2
rsrunug
drrs
e 2
rsrunug
drrs
d 2
rsrunug
srrd
d 2
rsrunug
srre
d 2
rsrunug
srre
e 2
rsrunug
errs
e 2
rsruntg
errs
e 2
rsruntg
ersr
e 2
rsruntf
ersr
e 2
ssruntf
ersr
e 2
struntf
ersr
e 2
struntf
ersr
d 2
struntf
essr
d 2
struntg
essr
d 2
ttrunsg
essr
d 2
ttrunsg
essr
c 2
ttrumsg
essr
c 2
ttrumsg
essr
b 2
ttrumsh
essr
b 2
ttrumsh
essr
a 2
ttrumth
essr
a 2
htmurtt
essr
a 2
htmurtt
essr
` 2
htmurtt
rsse
` 2
htmurtt
rsse
a 2
htmurtt
rsse
b 2
htlurtt
rsse
b 2
htltrtt
rsse
b 2
ttrtlth
rsse
b 2
ttrtmth
rsse
b 2
htmtrtt
rsse
b 2
ttrtmth
rsse
c 2
htmtrtt
rsse
c 2
htmtrtt
rssf
c 2
htmtrtt
rsrf
c 2
ttrtmth
rsrf
c 2
ttrtmth
rsre
c 2
thrtmtt
rsre
c 2
thrtntt
rsre
c 2
thrtntt
rsse
c 2
ttrtnth
rsse
c 2
ttqtnth
rsse
c 2
ttqtnth
ress
c 2
tqttnth
ress
c 2
tqttnth
resr
c 2
uqttnth
resr
c 2
uqttnth
ersr
c 2
nqttuth
ersr
c 2
nqttuth
ersr
d 2
nqttuth
srer
d 2
htuttqn
srer
d 2
htuttnq
srer
d 2
htuttnq
srer
c 2
htuttnq
sqer
c 2
htuttnq
tqer
c 2
htuttnq
tqer
b
1 1
 2
 3
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 2
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 2
 1
 1
 1
 1
 2
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
