human
Count of words whose i | Return the count of words ..
If word contain single letter , return 1..
Checking for first letter ..
Traversing the string and multiplying for combinations ..
If all three letters are same ..
If two letter are distinct ..
If all three letter are distinct ..
Checking for last letter ..
Driven Program"
How can the above be solved in Python?
 ... Write me a code to count of words whose i and the other steps required?
assistant
#Here is code to count of words whose i and the other steps required.
 def countWords ( str , l ) :
	count = 1 ;
	if ( l == 1 ) :
		return count
	if ( str [ 0 ] == str [ 1 ] ) :
		count *= 1
	else :
		count *= 2
	for j in range ( 1 , l - 1 ) :
		if ( str [ j ] == str [ j - 1 ] and str [ j ] == str [ j + 1 ] ) :
			count *= 1
		elif ( str [ j ] == str [ j - 1 ] or str [ j ] == str [ j + 1 ] or str [ j - 1 ] == str [ j + 1 ] ) :
			count *= 2
		else :
			count *= 3
	if ( str [ l - 1 ] == str [ l - 2 ] ) :
		count *= 1
	else :
		count *= 2
	return count
if __name__ == " _ _ main _ _ " :
	str = " abc "
	l = len ( str )
	print ( countWords ( str , l ) )