Simple Programming Exercise for counting word frequency in a Text