Hi,
In mock test Q2, X.LetterCount is added to A only if the word ends with a full stop. So A here stores sum of letter count of words which are at the end of each sentence.
Whereas in Week2 GA Q3, Letter count is added to variable B up to when word ends with full stop. Then B is stored in A after comparing with value of A and then B is reinitialized to 0. So here A stores length of the longest sentence based on the number of characters.
Don't confuse with same variable used in different problems. Try to understand the concept used in the problems.
Hope your doubt is cleared if not write us again.
Regards,
Deepak
IITM Online Degree Team