fork download
  1. s = input()
  2. target = input()
  3. replace_word = input()
  4. words = s.split()
  5. result = []
  6. for word in words:
  7. if word == target:
  8. result.append(replace_word)
  9. else:
  10. result.append(word)
  11. print(' '.join(result))
Success #stdin #stdout 0.11s 14124KB
stdin
Although I am without you, I will always be ou you
ou
with
stdout
Although I am without you, I will always be with you