#!/usr/bin/env python
# -*- coding: utf-8 -*-
# WARNING ! This script require python 3 or more, for UTF8 support.
import sys
import re
from_str,to_str=sys.argv[1:3]
contents=sys.stdin.read()
pat_str=r'(?<!-)\b%s\b(?=[^-]|\Z)'%from_str
pat=re.compile(pat_str,re.UNICODE|re.IGNORECASE)
result=pat.sub(to_str,contents)
print(result) 

# This script above don't ignore case :
##!/usr/bin/env python
## -*- coding: utf-8 -*-
#import sys
#import re
#from_str,to_str=sys.argv[1:3]
#contents=sys.stdin.read()
#pat_str=r'(?<!-)\b%s\b(?=[^-]|\Z)'%from_str
#pat=re.compile(pat_str,re.UNICODE)
#result=pat.sub(to_str,contents)
#print result