Alexander K. answered 03/20/24
Experienced University Tutor Specializing in Python and Java
You can iterate through each character in sentence until you find a space. Once you encounter a space, you can set your secondWord variable to start storing each character you encounter after that first space. Your exit condition is either when you see another space (indicates the end of the second word), or see a period (indicates the end of a sentence). One thing you may want to watch out for is if your sentence is a single word such as "Cat.", then you want to handle that case accordingly and ensure that your code doesn't break when it reaches the end of the sentence without encountering a space. Let me know if you need any further clarification.