The Society for the Prevention of Profanity on the Internet has realized that many people were able to circumvent their censorship system by using special characters. For example, four
is a four letter word that needs to be censored, however, people will put it at the end of a sentence, as in four.
, and the censorship system breaks apart. Another case where it breaks apart is when people try to use 1337 speak, such as l33t
or 1337
.
Your task is to write a program that censors all four letter words with ****
, even if they are surrounded by punctuation or written in 1337 speak.
Input Specification
The input to your program consists of an integer, , on a line by itself, followed by lines of text. Each line of text contains ASCII text containing letters, symbols, and spaces. Lines do not exceed characters in length.
Output Specification
Output each line of text, with four letter words replaced by ****
, while preserving all other characters, including spaces.
Sample Input
6
The Society for the Prevention of Profanity on the Internet has realized that
many people were able to circumvent their censorship system by using special
characters. For example, "four" is a four letter word that needs to be
censored, however, people will put it at the end of a sentence, as in "four.",
and the censorship system breaks apart. Another case where it breaks apart
is when people try to use 1337 speak, such as "l33t" or "1337".
Sample Output
The Society for the Prevention of Profanity on the Internet has realized ****
**** people **** **** to circumvent their censorship system by using special
characters. For example, "****" is a **** letter **** **** needs to be
censored, however, people **** put it at the end of a sentence, as in "****.",
and the censorship system breaks apart. Another **** where it breaks apart
is **** people try to use **** speak, **** as "****" or "****".
Comments
does anyone know how to use the POSIX character classes in python? For some reason, none of the character classes work. Is there an alternative to such since python doesn't support it.
https://docs.python.org/3/library/re.html
Are numbers considered as words? For example, would 1234 be censored or not?
In the sample case, 1337 (near the end) is censored. So yes, numbers are included.
Is there any thing other than letters and numbers that I need to take into account?
I mean, for the words we must censor, is it only letters and numbers that we must replace with "*"?
Punctuation