Suppose that the following string is received under the bits
Suppose that the following string is received under the bit-stuffing rule associated with the flag 0 1 1 1 1 1 1 0. Remove the stuffed bits from the bit string.
0 1 1 1 1 1 0 0 0 1 1 1 1 0 0 1 1 1 0 0 0 0 0 1 1 1 1 1 0 1 0 1 0 0 0 1 1 1 1 1 0 0 0
Solution
import java.util.Scanner; /** * Created by RahulPatidar on 07/11/16. */ public class RemoveBitStuff { public static void main(String args[]){ Scanner sc = new Scanner(System.in); // Assuming that the first line of input is bitStuff string and second line is input bit string String bitStuff = sc.nextLine().replace(\" \",\"\"); StringBuilder inputString = new StringBuilder(sc.nextLine().replace(\" \",\"\")); int m = bitStuff.length(); int i=0; while(i