for i in text:
if (i == ' '):
Without defining I am checking my code....there are a coup-le of problems:
1. ' ' won't take the last word into consideration until I put ' ' in the last while entering the text
2.I checked using print statements and in the second last if loop it enters and prints (j) and (word) but doesn't compare the word==j for the next loop.