fork download
  1. def censor(text, word):
  2. text = list(text.split())
  3. censored_text = ""
  4. for i in text:
  5. if i == word:
  6. c = len(word) * "*"
  7. text.insert(text.index(i), c)
  8. text.remove(word)
  9. return " ".join(text)
  10. print censor("pidoras idet kudato pidoras pidoras", "pidoras")
Success #stdin #stdout 0.01s 7852KB
stdin
Standard input is empty
stdout
Standard output is empty