Any layer2 protocols (and LAPD too) uses frames for information transfer. Each frame is separated from other frames by means of Flags (01111110). To avoid flag imitation in information bit flow (in user data between two consequent flags) following is provided:
Transmitter shall to insert “0” after each block of 5 continuous 1s in user data.
Reciever shall to delete “0” after each block of 5 continuous 1s. If Reciever has detected 6 continuous 1s in combination 01111110, it comes to a conclusion this combination is Flag (opening or closing).