6 kyu

Duplicate Encoder

20,736 of 233,006obnounce
Description
Loading description...
Strings
Arrays
Fundamentals
  • Please sign in or sign up to leave a comment.
  • SigmaAkainu Avatar

    This comment has been deleted.

  • SSSilverr Avatar

    This comment has been hidden.

  • CornSnek Avatar

    This comment has been hidden.

  • knockacode Avatar

    Is this code bugged in Ruby? Running "test" only runs one test (which it passed). I had to manually check every listed test, which all match. But when I try to submit, it fails...something...

  • RichardNesbitt Avatar

    This comment has been hidden.

  • FranzMartyn Avatar
  • EvgeniiaGrin Avatar

    This comment has been hidden.

  • TheRealPharaohFresh Avatar

    the problem i am having is do i copy the sample test or do i create my own words and code?

  • Macinho 7 Avatar

    When I first looked at it, I thought, "This one is really easy, I'll solve it quickly." ... ☠️

  • adesiredresult Avatar

    This comment has been hidden.

  • ASTRICKK Avatar

    This comment has been hidden.

  • EvenTailer Avatar

    random checks produce different results, sometimes ")" is ")", and sometimes "(", although they are not repeated.

  • Homsi Avatar

    I'm writing in js and it's not clear to me what is required of me. I've refactored the code several times, but I get the same error when I try to

    /home/codewarrior/index.js:78
          (map, ch) => map.set(ch, (map.get(ch) ?? 0) + 1)
                                                 ^
    
    SyntaxError: Unexpected token ?
        at createScript (vm.js:80:10)
        at Object.runInThisContext (vm.js:139:10)
        at Module._compile (module.js:616:28)
        at Object.Module._extensions..js (module.js:663:10)
        at Module.load (module.js:565:32)
        at tryModuleLoad (module.js:505:12)
        at Function.Module._load (module.js:497:3)
        at Module.require (module.js:596:17)
        at require (internal/module.js:11:18)
        at [eval]:1:1
    
  • Kikemm11 Avatar

    Someone know why does this happen:

    should ignore case: '(())())' should equal ')())())'

    Besides that test everything ok :)

  • metatable Avatar

    This comment has been hidden.

  • llmmzz Avatar

    wrong testing for lowercase regex, works in vsc but not here

  • Xros22 Avatar

    nice little exercise. at least a couple of different ways to do it, and nothing tricky. looks like historically the tests might have needed some attention, but seem fine now (python)

  • HundredSongs Avatar

    Passed the basic_tests after 1-2h, now I'm stuck at randoms....

  • weixicai Avatar

    I don't know why fail,

    [----] test.c:22: Assertion Failed [----]
    [----] for string: "walk" [----] expected: "((((" [----] but got: "((((" [----]
    [FAIL] duplicate_encoder_function::sample_tests: (0.00s)

  • SS-Stefanov1 Avatar

    Fun, but way too easy for 6 KYU..

  • Wurns Avatar

    I think they should remove the test with parantheses because parantheses are obviously no letters. My programm works fine but only for letters so....

  • BenitoEck Avatar

    This comment has been hidden.

  • GermanPachec0 Avatar

    This comment has been hidden.

  • Rezishon Avatar

    This comment has been hidden.

  • notmangareader Avatar

    Test doesn't match the description.

    Description: each character in the new string is "(" if that character appears only once in the original string, or ")" if that character appears more than once in the original string.

    Test: Expected : )))))) to equal : )))))(

    There are no chars in the original string that appear only once, any of ")" appear more then once, even the last one. There is no rule "more than once AFTER its position".

    My solution passes all tests except this one because I use strings.ReplaceAll() for all duplicates in go lang.

    Fix this test pls.

  • AlexHutchingsMusic Avatar

    This comment has been hidden.

  • AntonAverianov Avatar

    I'm not a pro but that is interesting

  • AntonAverianov Avatar

    That's prety fun

  • Magnalium Avatar

    I'm able to pass the sample cases, but the cases tested when I click "attempt" don't pass.

    I try ending the string with the null character '\0', but when indexed at +1, it always prints one character extra. without the +1, it says the test cases failed.

    Before I ended with the null character it just attached an arbitrary number of characters after the original string, but that I did sort out

  • Kinga79 Avatar

    This comment has been hidden.

  • sciucca8 Avatar

    This comment has been hidden.

  • ifedayoprince Avatar

    I think the instructions are wrong. It says "you can ignore capitalization" and when i ignore capitalization, the word Supralapsarian fails, it says that the first 'S' is not repeated when it is if you follow the instruction and "ignore capitalization".

    Enabling capatilization causes my tests to fail, disabling it causes tests to pass, but 'Attempts' to fail.

  • Wojtuma Avatar

    Remember that Lower Case matters!!!

  • maximmarinovskyi Avatar

    Looks there is a mustake in current KATA. My code in VSCode get different inouts between here in JavaScript.

  • PawelKinczyk Avatar

    This comment has been hidden.

  • Encr1pt0r Avatar

    Completed the solution in JavaScript

    Once I understood the difference between the brackets in the output, it was a good challenge to beat.

    Only feedback I can give is to add to the output explaination (whats below) the diffence between the brackets so it would make sense to new challengers faster.

    "(" = Character that only appears once ")" = Character that only appears more than once

  • yasnoslv Avatar

    This comment has been hidden.

  • Pouet36 Avatar

    This comment has been hidden.

  • lkordy Avatar

    this kata non-correct work with replace (python)

  • url54 Avatar

    Seems like there is a bug in this one, for Rust. Or the characters are using different encodings. In my case, the C in CodeWarrior is getting dropped but matches should find at least 1 of every letter. Then in Supralapsarian matches is returning three individual occurences of "s" instead of one group of three "s"'s. I don't know if you can see my code and what actually gets printed out using Rust matches?

  • Lebaozki Avatar

    This comment has been hidden.

  • Josh-Darling13 Avatar

    I feel like I'm missing something...

    If a character shows up in a string more than once should be replaced with ')'

    So shouldn't ')))(()())())' output as '))))))))))))' and not ''()(((())())' <~~~ what they are saying it should be?

  • macree Avatar

    [C++] I literally tried my code with the input case "Success" and it displays the correct output on my compiler. But on this website, when I run, it displays "(((c())" instead of ")())())"

  • LeanderMejia Avatar

    I'm new in CodeWars I'm having a problem in testing my solution it return: '( ( (' should equal '(((' '( ) ( ) ( )' should equal '()()()' should ignore case: ') ( ) ) ( ) )' should equal ')())())' ') ) ( (' should equal '))((' Even the result I get is correct.

  • PR3SS F Avatar

    Extremely satisfying kata for this level, have fun!

  • Awwal12 Avatar

    how does one solve this... damn makes my head hurt

  • user5970349 Avatar

    This comment has been hidden.

  • Raxel01 Avatar

    I have even know that 'S'=='s' until I pass this test haha they are not the same btw difference in ascii code for your programme as exemple in C language if an alphabet in input string is upper and the same character occure or repeated with lower cas it should be the same :)

  • techslugz Avatar

    does anyone know why I cant delete anytjing that I tyoe type throughout this website? it does it here in comments, I cant delete any misstyped chars.. but ecv even worse on my o code

  • Snorri_Sturlusson Avatar

    None should equal '(((' None should equal '()()()' should ignore case: None should equal ')())())' None should equal '))((' Why? I have the result just the one that is required to pass. I don't understand, what need author

  • cleorodrigues21 Avatar

    This comment has been hidden.

  • Diacax Avatar

    Is there a listing of what is included in the system for testing? I was getting an error that .Count is not available on character arrays in C# newest. This is a standard function and couldn't get the system accept the answer. If there is a listing so I can setup my testing environment close I would appreaciate it.

  • sirdavy Avatar

    My solution passes all the fixed tests when I click on test but when I click attempt I get this message saying it failed:

    should pass fixed tests Expected: "()(((())())", instead got: "))(()())())"

    I don't understand. "Expected: "()(((())())"" isn't even in the fixed tests suite.

    Also another 'random test' fails, it tells me the output is not what was expected but I cannot see what the input was from this random test.

  • DonGerardo Avatar

    I failed this test... should ignore case: expected '(())())' to equal ')())())' I don't understand Each character occurs more than once, so it should equal ')))))))'... Anyone see what I am missing?

  • marodriguezs Avatar

    This comment has been hidden.

  • 2swulcoal Avatar

    This comment has been hidden.

  • BGbasta Avatar

    why that stupid calloc ?

  • avichii Avatar

    another good kata. time for the the next one.

  • LYU4662 Avatar

    This comment has been hidden.

  • PedroPCardonaA Avatar

    This comment has been hidden.

  • cgtrz Avatar

    This comment has been hidden.

  • d13.kstudent Avatar

    what should i return in this function? just string?

    i have made everything right, all outputs matchbut in the result i have red window, i thought may be i returned something different from what author wanted

    help please! i am writing on c

  • Alterra Laniakea Avatar

    Error on Python Having difficulty fixing the issue on basic test case "(( @" Sometimes it does give the right result sometimes it doesn't

  • mattiab01 Avatar

    This comment has been hidden.

  • BerouForever Avatar

    Hello , I have a question on this command : string_.remove(k) this line doesn't work (from by class its supposed to work) maybe I've done something wrong

    does someone know the command to remove a value from a string ? Thanks

  • bmayag Avatar

    This comment has been hidden.

  • AlexDRichards Avatar

    Is there a way to see what the random tests are supplying as arguments to the function you write? I can see what is supplied to the fixed tests, but all I get in the error read out is what was expected and what my function returned, but it would be more helpful if I could see what argument was being passed in during the random tests. I'm in Ruby. Thanks to whoever can make this clear! (I've been to the trouble shooting page but the part about printing out the error message didn't help me. If someone could tell me what to write into my code to see what is being supplied in the random tests that would be enough to help me do it for all the others. Thanks! (my language is Ruby)

  • grayblack-code Avatar

    Anytime I hit ATTEMPT i get different fails and passes. The test cases with ( or ) keep switching from passed to failed; all except the "test.assert_equals(duplicate_encode("(( @"),"))((") ". What could be the problem? I'm using python

  • uaravindshenoy Avatar

    It's telling me that I've failed "Testing for fixed tests expected '' to equal '(((' ". I'm not clear on what that means.

  • nick_eastman Avatar

    What does "Exit code: 132" mean? I asked before and didn't get any answer.

  • ira__bagira Avatar

    This comment has been hidden.

  • nick_eastman Avatar

    This comment has been hidden.

  • ChivalKnight Avatar

    It won't let me test my code, it's throwing me an error from the test part itself.

    File "tests.py", line 8 test.assert_equals(def duplicate_encode(word): ^ SyntaxError: invalid syntax

    That is not my code. Also, my code works when I hit the "attempt" button, just not the test button. What my code did on the attempt button: Time: 524ms Passed: 48 Failed: 0

  • кж молодец Avatar

    заебись круто класс

  • Molyavin_Alexandr Avatar

    Doesn't work right with vector pairs. In VS 19 works fine

  • Scorp81 Avatar

    Cant understand this one: Incorrect answer for 'CodeWarrior': expected '))(()())())' to equal '()(((())())', cause "C" and "W" are not double.

  • aiyanope Avatar

    This comment has been hidden.

  • knfs97 Avatar

    This comment has been hidden.

  • maame-deveer Avatar

    This comment has been hidden.

  • cihanim Avatar

    This comment has been hidden.

  • SadBoiVic Avatar

    This comment has been hidden.

  • rsschool_3dd9c51c71526a57 Avatar

    This comment has been hidden.

  • nkh2023 Avatar

    This kata seems to not work with .replace methods in JavaScript. I got solution right, and it works fine in node or devtools, but fails here with type error "replaceAll is not a function", because it gets confused with braces in quotes: replaceAll( word[i], ")" ). Or it simply do not accept solution with replace method. Tests are not parsing code in a right way.

  • kiritovish Avatar

    This comment has been hidden.

  • rsschool_91627c1aa67bbc66 Avatar

    hey guys. i am solving with js, and when i want to add ")" to string, it raises an error SyntaxError: Invalid regular expression. It works OK with letters, but not with "(" or ")". can anyone help?

  • CEP18 Avatar

    Hi!

    It works in my IDE but not here. The only test that fail is: "Supralapsarian"

  • hobovsky Avatar

    Javascript: solutions which do not handle different case pass all random tests.
    Random tests do not generate inputs with different case reliably.

  • Kleo Wyatt Avatar

    Hello everyone, I don't understand the test: should ignore case: expected '(())())' to equal ')())())' but '(())())' should return ')))))))' - shouldn't it?

  • amir hassan Avatar

    Sample testCase error (Supralapsarian) in this string capital 'S' and 's' occur but expected output is for capital S is ')' and for small S is '(' Supralapsarian Expected output = )()))())())()( My output = )()))()))))()(

    detail given in instructions tab "Success" => ")())())" here Small and Capital gives same ) bracket then why in Sample test cases small and capital letter gives different result.

  • Heseneli Avatar

    i use C, and i passed all tests but the last one. i think it is a kata problem because it is the only one, function failed. also program worked very well in my pc locally.

  • MrHanlok Avatar

    I have a really weird problem with this. I am using javascript as language everything is going good. But whenever I try to return my result it's breaking my function. console.log() works how I want it but when I switch it to the return at the end it's breaking the loops and duplicate mess up with my result.

    Example console.log(result.join('')) // prints: (((

    return result.join('') //prints: ((((((

    Also tried: console.log(result.join(''))> return (result.join('')) // which means I just deleted console.log() and write return. with parentheses included and without them. can anyone help me

  • DHKLOK Avatar

    First I tried counting using a dictionary and using replace based on K,V pairs. and second I tried using replacing iterating over the word Both of these methods were unsuccessful.

    I think for some reason it really really did not like using replace based on count values. I just couldnt get it to work in the end. I ended up giving up and saw most everyone using newstring += ')', which I was going to do but I was too stubborn because I wanted to use the K,V in dictionary. I think I overthought this one :(

  • delsix Avatar

    really nice kata

  • scladnik Avatar

    good kata

  • Erik_Norden Avatar

    This comment has been hidden.

  • Cinghio Avatar

    This comment has been hidden.

  • Eddie_Pulido Avatar

    The 'Success' test is not a good one to see if the user is ignoring uppercase. If they iterate through a lowercase array without changing the original word to lowercase, you still get the correct result because there are two lower case 's' at the end. A better test case would be something like 'Aba'

  • 1GCONF Avatar

    This comment has been hidden.

  • Pier_Lanzi24 Avatar

    This comment has been hidden.

  • mirzapm13 Avatar

    This comment has been hidden.

  • dvlch Avatar

    I wrote it with c++. It has been a while since I wrote c++ or use this website.

    If anyone want to check my solution: https://www.codewars.com/kata/reviews/5d5ed826ad2c6800010db5d3/groups/627fcd97d6bf32000121cd8e I would love if someone has any better practices to suggest to me.

    Thanks!

  • nilslueschow Avatar

    This comment has been hidden.

  • ExampleTrue Avatar

    If solution for this string: 'eyeedG)meOeeeben' , is that string : '(())(()()()))()(' , why firs element[0] and last but one[.length-2] is not equal?

  • AWackO Avatar

    This comment has been hidden.

  • almeida20 Avatar

    Helloo !

    I'm stuck with this because in the problem say to ignore capitalization when determining if a character is a duplicate, but then in the tests i don't think it does what the description says.

    Look at some examples:

    "Success" => ")())())" <- here they are assuming that 'S' == 's', so the parenthesis are going to be ')' when a 'S' or 's' exist

    Otherwise in the tests

    "Prespecialized" => "(()(()()(()()(" <- it's assuming 'P' != 'p', so the parenthesis are going to be '(' when a 'P' ( but it should be ')' right ?? according to what is above )

    Maybe i misunderstood If someone could help i appreciate ^^

    Ps: C language

  • karakarasuuuu Avatar

    The template should contain the name of the parameter, and it should be mentioned that this kata does not request for in-place replacement, in fact, it's not allowed to do that in C.

  • Soikk Avatar

    The exercise talks of "characters" ("if that character appears only once") but treats the characters 'P' and 'p' as if they were the same. Badly written details.

  • simpluc23 Avatar

    This comment has been hidden.

  • robiulhr Avatar

    good kata.

  • babyboy1111 Avatar

    This comment has been hidden.

  • UsernameTakenHostage Avatar

    The kata was really interesting and I've had fun solving this!

  • iTzMiNOS Avatar

    This comment has been hidden.

  • yewinag Avatar

    finished my solution, but I getting this error, ReferenceError: Test is not defined. How would I do that? Can you please any suggestion?

  • Johants Avatar

    This comment has been hidden.

  • Johants Avatar

    This comment has been hidden.

  • makafild Avatar

    This comment has been hidden.

  • TheLegendKylo Avatar

    Hi Guys what could be going here ? The stuff matches... i am returning String as the assert expects

    Taken from output: Basic Test Cases Log ((( None should equal '(((' Log ()()() None should equal '()()()' Log )())()) should ignore case: None should equal ')())())' Log ))(( None should equal '))(('

  • user6261225 Avatar

    This comment has been hidden.

  • mr_no Avatar

    hey folks, surely this is not correct? getting this when i attempt the case

    '))))))' should equal ')))))('
    

    i am also getting this in attempt

    Tests with '(' and ')'
    Test Passed
    '))))))' should equal ')))))('
    
  • akar-0 Avatar
  • steebn Avatar

    Would be nice if the latest version of Node was being used so we could use modern code.

    SyntaxError: Unexpected token '??='

  • user171717x Avatar

    Testing for word "VURU oRVpSLtvQWtivi": '))))(())())))))))))' should equal '))))(())((())(())))'

    Thats WRONG TEST, fix it pls!

  • haha4un Avatar

    This comment has been hidden.

  • ArielBarkan Avatar

    Hi, My test work but when I'm trying to submit I'm fetting the following error:

    /* error start / Tests with '(' and ')' expected '))))))' to equal ')))))(' / error end */

    According to my knoledge both options are wrong ( option '))))))' and option ')))))(' ). Did anyone know how to solve this issue? :)

  • UNarium Avatar

    I am a student in a university and I would need to have an answer to this exercise which could unlock me for one of my exams. Thank you I am studying for my January exams so this is really important!

  • danilovxp Avatar

    This comment has been hidden.

  • nikaiko Avatar

    This comment has been hidden.

  • danilovxp Avatar

    This comment has been hidden.

  • LineEast Avatar

    This comment has been hidden.

  • zola123 Avatar

    code works fine on my compiler and i get the correct result but when i enter the same code to the test here i get a different result can someone help me?

  • user4896126 Avatar

    enjoyed this kata

  • Andy332 Avatar

    This comment has been hidden.

  • Solrail Avatar

    This comment has been hidden.

  • Logomon Avatar

    This comment has been hidden.

  • AnnieDay Avatar

    Hi! I'm getting the "(" and ")" allocation I want, but all results fail. I've tried adding an additional str(response) validation, to no avail.

  • Kasymbekov Avatar

    expected:<[)()))()))]))()(> but was:<[(()))())(]))()(> Other IDE's output: <()))))()))))))))> Looking for a solution...

  • sbozich Avatar

    What is here test string (3rd basic test)?

    Kata.DuplicateEncode("Success"), "should ignore case");

    This is uncallable in any IDE: DuplicateEncode("Success"), "should ignore case");

  • KonradChyrzynski Avatar

    This comment has been hidden.

  • akar-0 Avatar

    Nim attempt tests throw warnings:

    STDERR
    /workspace/solution_tests.nim(22, 6) template/generic instantiation of `test` from here
    /workspace/solution_tests.nim(24, 23) Warning: Deprecated since v0.18.0; use 'rand' instead; random is deprecated [Deprecated]
    /workspace/solution_tests.nim(22, 6) template/generic instantiation of `test` from here
    /workspace/solution_tests.nim(25, 33) Warning: Deprecated since v0.18.0; use 'sample' instead; random is deprecated [Deprecated]
    /workspace/solution_tests.nim(22, 6) template/generic instantiation of `test` from here
    /workspace/solution_tests.nim(25, 32) template/generic instantiation of `random` from here
    /opt/nim/lib/pure/random.nim(231, 14) Warning: Deprecated since v0.18.0; use 'rand' instead; random is deprecated [Deprecated]
    /workspace/solution_tests.nim(22, 6) template/generic instantiation of `test` from here
    /workspace/solution_tests.nim(25, 32) template/generic instantiation of `random` from here
    /opt/nim/lib/pure/random.nim(231, 20) template/generic instantiation of `random` from here
    /opt/nim/lib/pure/random.nim(227, 14) Warning: Deprecated since v0.18.0; use 'rand' instead; random is deprecated [Deprecated]
    
  • Ohen Avatar

    This comment has been hidden.

  • Dess1996 Avatar

    Good kata. Quite simple for 6kyu for my opinion.

  • CadisKurane Avatar

    This comment has been hidden.

  • aspope Avatar

    I'm confused as to whether I should ignore case or not. It seems like some of them do and others don't

  • kavigihan Avatar

    Why is this giving me a timeout when submitting even I have passed the test?

  • cg-cnu Avatar

    How come I am seeing the solution prefilled ? And the tests seems to be broken.

  • Houiinkyouma Avatar

    This comment has been hidden.

  • rohailkhan Avatar

    Hi, something wrong with the submit. All my test ok but when I submit it says

    '((((((' should equal ')))))('

    but instructions says that any character more than 1 time should be displayed as ')' My output is ))))))' which is just according to instructions as all ( comes more than 1 time so they are all converted to )

  • robE357 Avatar

    This comment has been hidden.

  • Shaun112345 Avatar

    Hey mine is working for letters only using .count. However not for symbols as they are counted as 0. Is there a version of .count which counts any character in a string? I can't seem to find one. Thanks!

  • ImAsriel Avatar

    If letter is duplicated in string, test says '(', but my program execute correct, and returned ')'. What the problem??

  • Puzzletrain Avatar

    This comment has been hidden.

  • Frodsham Avatar

    I get a fail for '))()' should equal '))((' this does not seem correct???

  • tongtienanh Avatar

    This comment has been hidden.

  • ymaschietto Avatar

    This comment has been hidden.

  • daw_liu Avatar

    This comment has been hidden.

  • onitel Avatar

    I used Java, I am new to this language but yet I did come at end to a string that in System.out.println(thatString) show this for the test ")()())()(()()(" but for returning that string, like return thatString; , I have an eror "Unclosed group near index 1, ( " . I even hardcoded this string at return for test, and I have this eror anyway. I did an Array, a List and a String Builder and then all of them transformed to String, nothing seems to work...

  • Nit16 Avatar

    This comment has been hidden.

  • Valentin Shilaev Avatar

    This comment has been hidden.

  • Toasted.Uranium Avatar

    This comment has been hidden.

  • shahab570 Avatar

    I tried with many solutions and nothing worked with javaScript. Codewars won't give me solutions. Hw can i solve this ?

  • Kawamatsu Avatar

    Hello everybody, I really like the Idea of this kata. However, there is one big problem that I faced: When looking at the tests, the creator of this kata implies, that 'S' is equal to 's'. So all uppercase characters are to be treated the same as lowercase characters. From my point of view, that is a wrong implication, since 'S' and 's' have different ascii codes! Change this please or make it clear in the description of the kata. Aside from that, great kata:)

  • Millennial_Polymath Avatar

    This comment has been hidden.

  • 743627PDSB Avatar

    Why is the case "(()))())())()(" not "))))))))))))))"? All the characters appear more than once.

  • CoryFaylor Avatar

    So I've solved this Kata all except for the last character in the string. My solution compares each character in the string to each one after it (to avoid comparing it to itself). However with the last one, there is nothing after it to compare to so it thinks that it's always a unique character. What are some ideas that could solve this problem?

  • wismith Avatar

    This comment has been hidden.

  • shafii Avatar

    This comment has been hidden.

  • petehunt66 Avatar

    This comment has been hidden.

  • abhinavbhatia5 Avatar

    This comment has been hidden.

  • CentillionOfCode Avatar

    My code works perfectly on python and I get the right answer but apparently when pasting it here it says I get something else. Example: CodeWars: duplicate_encode("ya(ew(lzQ)") - wrong "))))))))))" should be "(()(()((((" The same code not on CodeWars: "(()(()((((" I have checked a bunch of errors and I always get the right answer yet on COdeWars it says I got it wrong, plz fix.

  • kamui29 Avatar

    hey guys i tried tested my code and it passed 3 out pf the 4 tests mentioned. the one which went wrong gives a message like this:

     should ignore case: '(())())' should equal ')())())'
    

    i tried adding main to the code with "success" as an argument to the function and it gave me the correct result as mentioned in the instructions:

    ")())())"
    
  • Hear Avatar

    Loved this one

  • oleg08 Avatar

    This comment has been hidden.

  • Archips Avatar

    This comment has been hidden.

  • jacks23 Avatar

    Please, help me to understand. My C# code has passed all basic tests but has failed Parentheses Tests and Random Tests. ParenthesesTests Test Failed Expected string length 6 but was 5. Strings differ at index 0. Expected: ")))))(" But was: "(((((" -----------^

    RandomTests Test Failed String lengths are both 18. Strings differ at index 3. Expected: "((()())(()()()((((" But was: "((((((((((((((((((" --------------^

  • JAFF-CYBERTHEIF Avatar

    can anyone help me I'm facing some problems with @

  • Aeolus_4 Avatar

    I am trying to solve this using dictionary in python. I am saving the number of occurrences of each character in the dict. And I check if that character comes up more than 1 time then I replace the character with ')' else with '('. The problem is for example if the word is "abca)" then when the interpreter gets to ')' it replaces all the previous occurrences of ')' with '(' as ')' occurrs only once. I don't understand why it changes all the previous occurrences and not just the current one. So my answer comes out to be "(((((". This problem does not happen in for example "abca(". For this I get ")(()(" which is the correct result.

  • The31 Avatar

    This comment has been hidden.

  • MouseGray Avatar

    This comment has been hidden.

  • splishsplosh Avatar

    This comment has been hidden.

  • kostis14 Avatar

    This comment has been hidden.

  • Smalli Avatar

    This comment has been hidden.

  • xashyy Avatar

    This comment has been hidden.

  • meatball-san Avatar

    Well, good day everyone! I have the solution and it is working perfectly in VS Code. But here, it is giving me the following error! ! should ignore case: '(())())' should equal ')())())' but this should not be the output according to the problem. So I added an iff statment for this error, but even with the given output, it is still giving me the same error. Am I not understanding it correctly? Is there something missing that I am not able to see? I would really appreciate if someone can help me in this.

  • dsalgaciello Avatar

    PHP:7.0: I created the function but when it is running the test it failed. I tested each test individually in local environment and it is giving the right results.

  • jpmaddox97 Avatar

    This comment has been hidden.

  • DenizNazar Avatar

    This comment has been hidden.

  • LorenzoPiombini Avatar

    Good eveving every one,

    I believe i got the solution, it pass the test, but i got an error anyway.

    Could anyone help me ? thanks

  • Max524 Avatar

    This comment has been hidden.

  • Mexstus123 Avatar

    This comment has been hidden.

  • gorakh999 Avatar

    This comment has been hidden.

  • alegro27 Avatar

    This comment has been hidden.

  • pontusnaslund Avatar

    This comment has been hidden.

  • Dimdimdude Avatar

    This comment has been hidden.