human
Modify a string by circularly shifting each character to the right by respective frequencies | Function to replace the characters by its frequency of character in it.
Stores frequencies of characters in the string S.
Traverse the string S.
Increment the frequency of each character by 1.
Traverse the string S.
Find the frequency of the current character.
Update the character.
Print the resultant string.
Driver Code"
How can the above be solved in Python?

=====
Give me a code to modify a string by circularly shifting each character to the right by respective frequencies and the other steps required?
assistant
#Here is code to modify a string by circularly shifting each character to the right by respective frequencies and the other steps required.
 def addFrequencyToCharacter ( S ) :
	frequency = [ 0 for i in range ( 26 ) ]
	N = len ( S )
	S = list ( S )
	for i in range ( N ) :
		frequency [ ord ( S [ i ] ) - ord ( ' a ' ) ] += 1
	for i in range ( N ) :
		add = frequency [ ord ( S [ i ] ) - ord ( ' a ' ) ] % 26
		if ord ( S [ i ] ) + add <= ord ( ' z ' ) :
			S [ i ] = chr ( ord ( S [ i ] ) + add )
		else :
			add = ord ( S [ i ] ) + add - ord ( ' z ' )
			S [ i ] = chr ( ord ( ' a ' ) + add - 1 )
	s = " "
	print ( s . join ( S ) )
if __name__ == ' _ _ main _ _ ' :
	S = " geeksforgeeks "
	addFrequencyToCharacter ( S )