human
Write me a code to check if a string can be split into 3 substrings such that one of them is a substring of the other two and the other steps required given the following:
Check if a string can be split into 3 substrings such that one of them is a substring of the other two | Function to check if string S contains any character with frequency >= 3 or not.
Stores frequency of characters.
Iterate over the string.
Update the frequency of current character.
Iterate over the hash array.
If any character has frequency >= 3.
Otherwise.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to check if a string can be split into 3 substrings such that one of them is a substring of the other two and the other steps required.
 def freqCheck ( S , N ) :
	hash = [ 0 ] * 26
	for i in range ( N ) :
		hash [ ord ( S [ i ] ) - ord ( ' a ' ) ] += 1
	for i in range ( 26 ) :
		if ( hash [ i ] > 2 ) :
			return " Yes "
	return " No "
if __name__ == " _ _ main _ _ " :
	S = " geekseekforgeeks "
	N = len ( S )
	print ( freqCheck ( S , N ) )