human
Give me a code to check length of a string is equal to the number appended at its last and the other steps required given the following:
Check length of a string is equal to the number appended at its last | Function to find if given number is equal to length or not.
Traverse string from end and find the number stored at the end . x is used to store power of 10..
Check if number is equal to string length except that number 's digits.
Driver Code"
Solution in Python:
assistant
#Here is code to check length of a string is equal to the number appended at its last and the other steps required.
 def isequal ( str ) :
	n = len ( str )
	num = 0
	x = 1
	i = n - 1
	for i in range ( n - 1 , - 1 , - 1 ) :
		if ( '0' <= str [ i ] and str [ i ] <= '9' ) :
			num = ( ord ( str [ i ] ) - ord ( '0' ) ) * x + num
			x = x * 10
			if ( num >= n ) :
				return false
		else :
			break
	return num == i + 1
if __name__ == " _ _ main _ _ " :
	str = " geeksforgeeks13"
	print ( " Yes " ) if isequal ( str ) else print ( " No " )