6 kyu

Exclamation marks series #12: Remove odd number continuous exclamation marks and question marks

193 of 353myjinxin2015
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • XoRMiAS Avatar

    The description is ambiguous as to where you should continue after removing one sequence. You could either start again at the beginning (removing everything strictly left to right) or you could continue from where you left off.

    Examples:

    • "??!!!???" could result in either "" or "??".
    • "?!!!???" could result in either "????" or "?".

    The kata requires the latter results.

    Please update the description to include instructions of how to handle situations such as this or change the random tests that these ambiguous strings can't be generated.

  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • trashy_incel Avatar

    Please don't post issue about difficulty or duplicate.

    this does not belong in the description

  • GarikGelios Avatar

    It was some kind of horror, I thought for three days and created a huge monster function. I need to learn regular expressions 😅

  • Treldman Avatar

    If we're supposed to remove from left to right, then why is '!!!!!!!????!!!!!!!??????!?????????!!!!!!!!!???' expected to return '??????????!' ? Does "Remove odd number continuous exclamation marks and question marks(from the left to the right), until no continuous exclamation marks and question marks exist" mean continue down the entire string a full pass before starting over to check for any new odd runs of exclamation or question marks?

  • Rud1 Avatar

    Nice Kata !

  • user9644768 Avatar

    Ruby 3.0 should be enabled.

  • Chrono79 Avatar

    Why is this wrong? "!!!!!!!!!!??!!?????????!?????????!!!!!!!!!!""!!!!!!!!!!??!!!?????????!!!!!!!!!!""!!!!!!!!!!???????????!!!!!!!!!!""!!!!!!!!!!!!!!!!!!!!" It expects "!!!!!!!!!!??" instead.

  • StefanPochmann Avatar

    Why is sol("!!!!") not "!"? I can remove "!!!", which is an odd number of continuous exclamation marks.

    Also, it's unclear what to do with for example sol("!!!???!!"):

    • Possibility 1: "!!!???!!""???!!""!!"
    • Possibility 2: "!!!???!!""!!!!!"""
  • GiacomoSorbi Avatar

    Ruby and Crystal translations :)

  • anter69 Avatar

    Good challange, interesting solutions, including monster regex patterns (at least in python :-)

  • GiacomoSorbi Avatar

    I would add some notes about how to do that: if you want to remove first all continous exclamation, then question mark, the other way around or all at once: right now the order of the operations is not meaningless.

  • suic Avatar

    This comment has been hidden.