human
Count of 1 | Function to return the count of required characters.
While there are characters left.
Single bit character.
Two - bit character.
Update the count.
Driver code"
Solution in Python:
assistant
#Here is code to count of 1 and the other steps required.
 def countChars ( string , n ) :
	i = 0 ; cnt = 0 ;
	while ( i < n ) :
		if ( string [ i ] == '0' ) :
			i += 1 ;
		else :
			i += 2 ;
		cnt += 1 ;
	return cnt ;
if __name__ == " _ _ main _ _ " :
	string = "11010" ;
	n = len ( string ) ;
	print ( countChars ( string , n ) ) ;