Because the teacher is in the middle, it is certain that the fourth position is written in white. The same color can't stand together, so AB students can only be in four positions, 1267, and they must be separated by one person. Then this problem is much simpler and can be divided into three situations. AB stands at 17, 26 and 16(27) respectively. These two situations are the same, just left and right reversed, and finally multiplied by 2.
① 1, position 7: Station A 1, No.7 Bili Bili, No.7 A Station, same as No.7 Bili Bili 1, and finally multiplied by 2. Because there are two people in black, they can't be adjacent to each other, so black is also on both sides, which are 25, 26, 35 and 36 respectively. Each station method DE can be transposed. Remember to multiply it by 2, EF and A22. Therefore, this method * * * is 2×4×2×A22=32.
② Pose 2,6: This is simple. AB ranks 26th or 62nd, and the others will not stand together in the same color no matter how they are arranged. So this station method is 2×A44=48 kinds.
③ Positions 1 and 6 (positions 2 and 7): discuss the station 16 first, and then multiply it by 2. In the same way, AB is interchangeable, and finally it has to be multiplied by 2. The CD is completely black, so it can't stand at the 23rd position, so there is A42-2 = 10 station method (25, 27, 35, 37, 57. Each CD is interchangeable, 5×2= 10) EF has 22 kinds of random stations, so there are 2× 16 stations * * = 40 kinds. The 27-station method is the same as the 16 station method, so 40×2=80 kinds.
Ok, add up to 160 species.
I hope this helps.