Problem:
Max Score: 250 Points

Problem Statement

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.

Sample Input 1

2
tourist
petr
e

Sample Output 1

1

There are no invisible part, so there are only one possibility.
The sorted handle names are e, petr, tourist, so e comes first.

Sample Input 2

2
?o?r?s?
?et?
e

Solution in C (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<stdio.h>
char s[10000][21],t[21];
int main(int argc, char const *argv[]){
	int n,a=0,b=0,i,j,bf,af;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",s[i]);
	}
	scanf("%s",t);
	for(i=0;i<n;i++){
		af=1;
		bf=1;
		for(j=0;j<20;j++){
			if(s[i][j]=='\0'){
				if(t[j]!='\0'){
					if(af) a++;
				}
				break;
			}else if(t[j]=='\0'){
				if(bf) b++;
				break;
			}else if(s[i][j]=='?'){
				if(t[j]=='a') bf=0;
				else if(t[j]=='z') af=0;
				else break;
			}else if(s[i][j]>t[j]){
				if(bf) b++;
			}else if(s[i][j]<t[j]){
				if(af) a++;
			}
		}
	}
	printf("%d",a+1);
	for(i=a+1;i<n+1-b+1;i++){
		printf(" %d",i);
	}
	printf("\n");
	return 0;
}