#include<stdio.h> #include<string.h> void bitStuffing(char *str) { int i, count = 0; char stuffedStr[100] = ""; // initialize an empty string to store the stuffed bits for (i = 0; i < strlen(str); i++) { if (str[i] == '1') { count++; if (count == 5) { strcat(stuffedStr, "0"); // stuff a '0' bit count = 0; } } else { count = 0; } char temp[2]; sprintf(temp, "%c", str[i]); strcat(stuffedStr, temp); } printf("Original string: %s\n", str); printf("Bit-stuffed string: %s\n", stuffedStr); } int main() { char str[100]; printf("Enter a binary string: "); scanf("%s", str); bitStuffing(str); return 0; }