# Collection of code snippets by Arne VajhÃ¸j 
# (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
# coding=ISO-8859-1

import string

replaces = { 'Sa' : 'så', 'ogsa' : 'også', 'pa' : 'på', 'ma' : 'må' }

s = 'Sa skal vi prøve dette ogsa, sagde jeg at jeg haber pa det virker.'

word = ''
for c in s:
    if c in ' .,;!?':
        if len(word) > 0:
            if word in replaces:
                print replaces[word]
            else:
                print word
            word = ''
        print c
    else:
        word = word + c
