CCC '98 S1 - Censor

View as PDF

Submit solution

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

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, n, on a line by itself, followed by n 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 n 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

Comments


  • 0
    LesterHo2  commented on Jan. 21, 2024, 10:02 p.m.

    Life is Roblox Like literally I know this is a made-up concept but like a really bad one(no hate to the creator) But I guess there isn't any other way to do this...


  • -1
    jakob_cigrovski3  commented on Dec. 21, 2022, 7:16 p.m.

    Can anyone tell me why this code does not fulfill all requirements? Thanks https://dmoj.ca/src/5141019


    • -1
      fireheartjerry  commented on Dec. 21, 2022, 10:46 p.m.

      You loop for n times, not n+1.


  • 0
    rnpmat08  commented on July 5, 2022, 1:00 a.m.

    I submitted my solution and it got approved, and when I try to see others' solutions, it says can't find the page. What's going on here?


  • -13
    Haoyun  commented on Jan. 16, 2022, 2:01 p.m. edit 2

    This comment is hidden due to too much negative feedback. Show it anyway.


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

    I don't get it...


    • -5
      Haoyun  commented on Jan. 16, 2022, 12:52 p.m.

      This comment is hidden due to too much negative feedback. Show it anyway.


    • -7
      Haoyun  commented on Jan. 16, 2022, 12:38 p.m. edit 7

      This comment is hidden due to too much negative feedback. Show it anyway.


      • -1
        Chad_Li1  commented on Sept. 11, 2022, 12:25 p.m.

        There should be n + 1 inputs. The 1 is the input n, and the rest are lines of text that follow it.


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

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


    • 7
      Tommy_Shan  commented on Sept. 11, 2021, 8:17 p.m.

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


      • -13
        Haoyun  commented on Jan. 16, 2022, 3:59 p.m.

        This comment is hidden due to too much negative feedback. Show it anyway.


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

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


    • 0
      rnpmat08  commented on July 5, 2022, 12:51 a.m.

      Lol I'm replying to ur comment from 2 years ago, but whatever. U can just use if (String.indexOf(" ") != -1), then the normal word cut, then in the else, just choose the entirety of the word as it's the last word, then moderate the word and yeah


  • -1
    moladan123  commented on Dec. 13, 2014, 8:09 p.m.

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


    • -5
      Kirito  commented on March 6, 2016, 8:22 p.m.

      This comment is hidden due to too much negative feedback. Show it anyway.