// 11000的在另一个文件中记录10;如过是00011的记录01
public static void main(String[] args) {
String str = "11000 11000 0 00011 11000 00011 11000 "; //
String target1 = "11000";
String target2 = "00011";
StringBuffer sb = new StringBuffer();
str = str.replaceAll(" ", "");
for (int i = 0; i < str.length();) {
String substring = str.substring(i);
int a = substring.indexOf(target1);
int b = substring.indexOf(target2);
if (a == -1 && b == -1) {
break;
}
i += (a < b && a != -1 ? a : b) + 5;
sb.append(a < b || b == -1 ? "10" : "01");