human
Check if all characters of a string can be made equal by increments or decrements | Function to check if it is possible to make all characters of string S same or not.
Length of string.
Stores the sum of ASCII value.
Traverse the string S.
Update the weightOfString.
If the sum is divisible by N then pr " Yes ".
Otherwise pr " No ".
Driver Code"
How can the above be solved in Python?
 Write me a code to check if all characters of a string can be made equal by increments or decrements and the other steps required?
assistant
#Here is code to check if all characters of a string can be made equal by increments or decrements and the other steps required.
 def canMakeEqual ( S ) :
	N = len ( S )
	weightOfString = 0
	for i in range ( N ) :
		weightOfString += ord ( S [ i ] ) - ord ( ' a ' ) + 1
	if ( weightOfString % N == 0 ) :
		print ( " Yes " )
	else :
		print ( " No " )
S = " beb "
canMakeEqual ( S )