Answer:
The code is given in Python below with its output.
Explanation:
"""
User is asked to enter the input in sentence
"""
sentence=input("Enter the sentence :")
"""
sentence is converted to list named words
"""
words=sentence.split()
same_letter_count=0
"""
In for loop we access each word
and check character at index 0 and at last index
is same or not.
"""
for word in words:
if word[0] == word[len(word)-1]:
same_letter_count+=1
print("The same letter count is",same_letter_count)
<u>OUTPUT::
</u>
TEST CASE 1::
Enter the sentence :students flock to the arb for a variety ofoutdoor activities such as jogging and picknicking
The same letter count is 2
TEST CASE 2::
Enter the sentence :i am a bit madam
The same letter count is 3