import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class Main {
public static void main(String[] args) {
String patternString = "b.d";
String[] testStrings = {"bud", "bid", "bed", "b d", "bat", "bd", "bead"};
Pattern pattern = Pattern.compile(patternString);
for (String testString : testStrings) {
Matcher matcher = pattern.matcher(testString);
if (matcher.find()) {
System.out.println(1);
} else {
System.out.println(0);
}
}
}
}
/*
run:
1
1
1
1
0
0
0
*/