## CCC '98 S1 - Censor

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 64M

Problem types

The Society for the Prevention of Profanity on the Internet has observed a growing number of chat lines on the World-Wide Web. A chat line allows a Web user to type lines of text which are transmitted to all other users. The Society is concerned about the number of four-letter words being transmitted by these chat lines and has proposed the mandatory use of software to remove all four-letter words from every transmission. Your job is to write the software to do this removal.

#### 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 words separated by spaces. Each word consists of letters of the alphabet and exactly one space separates adjacent words. Lines do not exceed 80 characters in length.

#### Output Specification

The output from your program should consist of the lines of text, with each four-letter word replaced by four asterisks.

#### Sample Input

2
The quick brown fox jumps over the lazy dog
Now is the time for all good people to come to the aid of the party

#### Sample Output

The quick brown fox jumps **** the **** dog
Now is the **** for all **** people to **** to the aid of the party

CCC problem statements in large part from the PEG OJ

• commented on Jan. 16, 2022, 9:01 a.m. edit 2

Me trying to solve this: Done! Me trying to solve this together: Why can't you understand this!

• commented on Jan. 16, 2022, 5:10 a.m. edited

I don't get it...

• commented on Jan. 16, 2022, 7:52 a.m.

But as far as I understood this task, you should slice out every word with four letters and replace it with ** (four stars). The variable n is just how many rows there are. The easiest way to do this is by putting the inputs in a list (one by one) and then splitting the list into the words. Afterwards you just have to check if they have four letters and replace them with the command replace. Could you help me in the other homework I don't understand the use of n in the task '''Sentences'''.

• commented on Jan. 16, 2022, 7:38 a.m. edit 7

Me too, Tina_Berlin, are the inputs two or is it only one big input?

• commented on Jan. 20, 2021, 2:27 p.m.

Imagine a social where you can't chat with 4 letters word.

• commented on Sept. 11, 2021, 4:17 p.m.

After a month, the people in this social learned to add an extra space between each character :)

• commented on Jan. 16, 2022, 10:59 a.m.

• commented on Jan. 13, 2020, 1:19 p.m.

If ur checking for spaces the last word wont have a space after it

• commented on Dec. 13, 2014, 3:09 p.m.

This returns some very interesting results, especially when you take something from the internet and put it into your code.

• commented on March 6, 2016, 3:22 p.m.

returns interesting results, especially you something the internet and put it your .

And it gets worse when you plug that into DMOJ's comments.