6 kyu

Backspaces in string

5,221 of 19,233vetalpaprotsky
Description
Loading description...
Fundamentals
Strings
Algorithms
  • Please sign in or sign up to leave a comment.
  • GTRTR1 Avatar

    Too easy for 6 kyu

  • aPixel Avatar

    This comment has been hidden.

  • mafiarm Avatar

    In JavaScript I get: expected ' ' to equal '6+yqw8hfklsd-=-f'. When I run the function in VS Code it retuns '6+yqw8hfklsd-=-f' not emply string(''). Am I doing something wrong?

  • marjan Avatar

    Done in C++.

  • Михaил Avatar

    Для меня описание принципа работы '#' было не достаточно и 6 примеров для тестов было мало, чтоб понять. Пришлось подглядеть готовые решения, из решений составить список для тестов и по их результатам только стала понятна задумка '#'. Тогда сразу получилось своё решение сделать.

  • 66  Avatar

    Language: C++
    Test suit missing the required header std::string

  • jvmdo Avatar

    The description should state clearly that the input string is composed by ANY character

  • Liamzy Avatar

    There's a CPS-based solution to this, isn't there?

  • Barsoum Eskander Avatar

    what i don't understand if i use s.replace('#', '\b') it works perfectly on pycharm. but not here ?! any one knows why ?! thanks in advance

  • pj777 Avatar

    Great outside-the-box kata

  • KayleighWasTaken Avatar
  • TumFly Avatar

    Do not really understand a task. Can someone help me pls???

  • lisit-sa Avatar

    expected 'rcvciotvshjtpttzrjrphncluxcqlkueycfiaiqqwajkmamocxtqjywkdbpjpyfxufrkgkctbnmtwrxlxtntmj' to equal 'frcvciotvshjtpttzrjrphncluxcqlkueycfiaiqqwajkmamocxtqjywkdbpjpyfxufrkgkctbnmtwrxlxtntmj'

    I can`t understand that . Why there is 'f' at the start?

  • derekMgwena Avatar

    Hi@everyone i'm having problems with my kata when i hit test or attempt it says " timed out conection blah blah " anyone to help me ?

  • tri@ Avatar
  • laurelis24 Avatar

    5 lines of code but it times out... I guess this should be solved without any loops or recursion? Nvm... xD Tricky.

  • akar-0 Avatar
  • Pick_Nick Avatar

    Damn. I started to smoke again. And it's so embarrassing to see the solutions of other

  • Baha_ Avatar

    To be fair, is it really kyu 6? It could absolutely be a kyu 7 kata. But anyway std::cout<<"Nice kata";

  • Skipperus Maximus Avatar

    console.log("I really enjoyed this kata!");

  • Bigoh20 Avatar

    Nice kata! ^^

  • ejini战神 Avatar

    TS: missing return type in initial solution setup

  • OBess Avatar

    I got it, what should i do? (C++)

    UndefinedBehaviorSanitizer:DEADLYSIGNAL ==1==ERROR: UndefinedBehaviorSanitizer: stack-overflow on address 0x7fffbca4a000 (pc 0x000000425520 bp 0x7fffbca490e8 sp 0x7fffbca48bf0 T1) ==1==WARNING: invalid path to external symbolizer! ==1==WARNING: Failed to use and restart external symbolizer! #0 0x42551f (/workspace/test+0x42551f) #1 0x428149 (/workspace/test+0x428149) #2 0x4269ce (/workspace/test+0x4269ce) #3 0x426523 (/workspace/test+0x426523) #4 0x4260fb (/workspace/test+0x4260fb) #5 0x42ab15 (/workspace/test+0x42ab15) #6 0x42577d (/workspace/test+0x42577d) #7 0x7fe13021abf6 (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6) #8 0x404569 (/workspace/test+0x404569)

    ==1==ABORTING

  • qrt88 Avatar

    This comment has been hidden.

  • Ettayeb-Chikhi Avatar

    guys actually it seems that my solutions works beacuse when i try some tests on my ide it works but on the tests it crashes and tell me: Test Crashed Caught unexpected signal: 6 i m using c thanks for helping :)))

  • ejini战神 Avatar
    • Node 18 should be enabled (Refer this and this for more info)

    • Python new test framework should be used (Refer this & this for more detail)

    • Ruby 3.0 should be enabled (Refer this & this for more detail)

  • AndreykaMen Avatar

    This comment has been hidden.

  • beloufaimededdine Avatar

    Test Results: all passed cleanString_test STDERR UndefinedBehaviorSanitizer:DEADLYSIGNAL ==1==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x0000000001ff (pc 0x00000042b16e bp 0x7ffc44d90f18 sp 0x7ffc44d909a0 T1) ==1==The signal is caused by a WRITE memory access. ==1==Hint: address points to the zero page. ==1==WARNING: invalid path to external symbolizer! ==1==WARNING: Failed to use and restart external symbolizer! #0 0x42b16d (/workspace/test+0x42b16d) #1 0x425648 (/workspace/test+0x425648) #2 0x428289 (/workspace/test+0x428289) #3 0x426b0e (/workspace/test+0x426b0e) #4 0x426663 (/workspace/test+0x426663) #5 0x42623b (/workspace/test+0x42623b) #6 0x42ac55 (/workspace/test+0x42ac55) #7 0x4258bd (/workspace/test+0x4258bd) #8 0x7fa2a874ebf6 (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6) #9 0x404639 (/workspace/test+0x404639)

    UndefinedBehaviorSanitizer can not provide additional info. ==1==ABORTING

  • YakubovKirill Avatar

    Solve it on TypeScript, but test failed on: 'O#Q#p#EL#3nj3##': expected 'Enj' to equal 'E3n' If we have ## at the end of line, we should remove 3 than j. But we expected j in answer. How does it works ?

  • FArekkusu Avatar

    C++ version generates warnings.

  • Vienio98 Avatar

    I cant pass last random test in C. Test Crashed Caught unexpected signal: 6 What does that mean ? Can i look at the randomtests?

  • rsa Avatar

    Clojure Translation ready for review

  • username0 Avatar

    This comment has been hidden.

  • wilsonteh Avatar

    ReferenceError: cleanString is not defined

    Why this error? What is the actual function name?

  • fibonaccios Avatar

    Fun recursion and regex paradigm kata. Reminds me I need to dig into regex deeper and better!

  • user4458990 Avatar

    Nice kata!

  • kisamict Avatar

    Solved it on Ruby, but one of the tests fails: Expected: "6+yqw8hfklsd-=-f", instead got: "6+yqw8hfklsd-=-fd"

  • uberrice Avatar

    Most solutions I find to this in C seemingly are inefficient with memory. They allocate memory according to the length of the source string, and make no effort to clean up the memory later. I'm primarily an embedded dev, so I'm very concerned with memory use if I can.

    My solution cleans up the memory afterwards by duplicating the string (that's terminated, but has too much memory allocated to it) to another pointer, freeing the original (longer than necessary) string and returning the size-optimized string.

    What's your opinion on this? Of course, if this is all used in a local environment that temporarily exists, which properly frees memory by some mechanism after it's done it's job. Then it's no problem. But if this function is run many times without freeing memory, my cleanup will use up less memory in exchange for a bit of processing time.

    What's best practice? Assume that output strings are only used temporarily and freed later, or make the strings effectively use space at the expense of processing time?

  • MarkoMilo Avatar

    Hello everyone, I solved this task, or I just thought that it is solved.

    My solution is broken after click ATTEMPT. If I test my code in Visual studio or GDB online, the program returns a good value. But in kata's tests wrote for example:

    Actual: "gd"

    Expected: "gdasda"

    String: "gfh#jds###d#dsd####dasdaskhj###dhkjs####df##s##d##"

    But when I test my solution in VS I got "gdasda", this is what you expect.

  • Steven Pavlovskii Avatar

    I'm super confused about this Kata, it's too algorithmic, I need help guys, any tips pleaseee)))

  • Muzozavr Avatar

    Oh damn, I'm really out of shape. I solved it, but not in the nicest way... :P

    My first thought was to create a regex pattern that would handle it all for me, but I couldn't figure it out since I'm shit at regex... had to look for a different way, but even then... a lot of unnecessary stuff in my solution.

    Nice kata.

  • Kennymelons Avatar

    i got a "Double free or Corruption Error" on c++. What could be causing this?

  • Oyedola Avatar

    pls help i couldn't solve this kata

  • Gwinguard Avatar

    Of course it's easy kata. But I'm trying to solve all katas using LINQ and I spend some time to found the solution for this one. Thank you for this kata. :)

  • Tigerhub779 Avatar

    Easy Kata :)

  • dundja92 Avatar

    This comment has been hidden.

  • Chrono79 Avatar

    Raising again both issues, if you can't solve it left it open one week so a power-user can really solve it.

    • The actual and expected values are swapped in the random tests in JavaScript (at least).
    • The function name should be in camelCase in JavaScript.

    AFAIK both things can be changed without disabling old solutions. See kazk's post below.

  • stellartux Avatar
  • FArekkusu Avatar

    The actual and expected values are swapped in the random tests in JavaScript (at least).

  • FArekkusu Avatar

    The function name should be in camelCase in JavaScript.

  • docgunthrop Avatar

    Elixir translation awaiting approval.

  • stellartux Avatar
  • xavierguihot Avatar

    Scala translation available for review.

  • anter69 Avatar

    Python translation kumited -- please check and approve

  • Unnamed Avatar

    Elm translation published

  • yichen Avatar

    If only you can show what you have entered in the error prompt

  • donaldsebleung Avatar

    Codewars Forums - Kata Best Practices - Follow Conventions

    JavaScript Version: Identifier names (i.e. variable/function names) should always be in camelCase (except for constructors, but that is something else entirely) and not snake_case (source: W3Schools) - please change the name of the user function from clean_string to cleanString.

  • MilesHeise Avatar

    my code passes all sample tests, and passes all fixed tests on hitting "attempt", but my attempts still fail because it times out after that. I'm guessing something in one of the random tests is causing it to loop infinitely, I guess? I don't want to get into spoilers, but the only thing I could think of that might cause a loop was a random string starting with too many # symbols before it got to letters. I wrote several different possible lines to account for that, though, and none of them prevent the timeout. not sure where to go from there, since I can't see what test is causing the problem?

  • Souzooka Avatar

    Hi, I made a C# Translation for this Kata.

  • kornev Avatar

    random tests needed