human
Check if a string has all characters with same frequency with one variation allowed | To check a string S can be converted to a variation string.
Run loop form 0 to length of string.
declaration of variables.
if first is true than countOfVal1 increase.
if second is true than countOfVal2 increase.
Driver code"
How can the above be solved in Python?

What is a code to check if a string has all characters with same frequency with one variation allowed and the other steps required?
assistant
#Here is code to check if a string has all characters with same frequency with one variation allowed and the other steps required.
 def checkForVariation ( strr ) :
	if ( len ( strr ) == 0 ) :
		return True
	mapp = { }
	for i in range ( len ( strr ) ) :
		if strr [ i ] in mapp :
			mapp [ strr [ i ] ] += 1
		else :
			mapp [ strr [ i ] ] = 1
	first = True
	second = True
	val1 = 0
	val2 = 0
	countOfVal1 = 0
	countOfVal2 = 0
	for itr in mapp :
		i = itr
		if ( first ) :
			val1 = i
			first = False
			countOfVal1 += 1
			continue
		if ( i == val1 ) :
			countOfVal1 += 1
			continue
		if ( second ) :
			val2 = i
			countOfVal2 += 1
			second = False
			continue
		if ( i == val2 ) :
			countOfVal2 += 1
			continue
	if ( countOfVal1 > 1 and countOfVal2 > 1 ) :
		return False
	else :
		return True
print ( checkForVariation ( " abcbc " ) )