a=int(input("enter string of 1's and 0's: "))
l=len(str(a))
print ('Length of bit: ',l)
a=int(a)
list1=[]
for i in range (0,l,1):
list1.append(a%10)
a=a//10
list1.reverse()
count=0
x=0
for i in range (0,l,1):
if(list1[i]==1):
count+=1
else:
count=0
if(count==5):
list1.insert(i+1,0)
i=i+1
x=x+1
str1 = ''.join(str(list1))
print ("At sender side:",str1)
l=len(str(a))
print ('Length of bit: ',l)
a=int(a)
list1=[]
for i in range (0,l,1):
list1.append(a%10)
a=a//10
list1.reverse()
count=0
x=0
for i in range (0,l,1):
if(list1[i]==1):
count+=1
else:
count=0
if(count==5):
list1.insert(i+1,0)
i=i+1
x=x+1
str1 = ''.join(str(list1))
print ("At sender side:",str1)
ScreenShot:
No comments:
Post a Comment