from itertools import groupby 

mysentence = ("As far as the laws of mathematics refer to reality "
              "they are not certain as far as they are certain "
              "they do not refer to reality")
words = mysentence.split() # get a list of whitespace-separated words
for word, duplicates in groupby(sorted(words)):
    count = len(list(duplicates))
    print('"{word}" is repeated {count} time{s}'.format(
           word=word, count=count,  s='s'*(count > 1)))