Calculate score for a string