4 kyu

Simplifying multilinear polynomials

2,812 of 4,907SleepingCode
Description
Loading description...
Mathematics
Strings
Regular Expressions
Parsing
Fundamentals
  • Please sign in or sign up to leave a comment.
  • ViacheslavMelnikov Avatar

    Hi! An error is issued: poly = 3a+b+4ac+bc-ab+3a-cb-a-a Sorry :( : 'b+4a-ab+4ac' should equal '4a+b-ab+4ac' by the condition of the problem, this is true! 'b+4a-ab+4ac'

    poly = -8fk+5kv-4yk+7kf-qk+yqv-3vqy+4ky+4kf+yvqkf Sorry :( : '-kq+3fk+5kv-2qvy+fkqvy' should equal '3fk-kq+5kv-2qvy+fkqvy' by the condition of the problem, this is true! '-kq+3fk+5kv-2qvy+fkqvy'

    Fix it or test it or tell me where I'm wrong.

  • DimsFromDergachy Avatar

    On Haskell there is a bug in testing code:

    In random tests, for example, having a list of monomials: ("", -1), ("b", -9), <...> so, the system says: expected: "--9b+ <...>" got: "-9b <...>"

    Obviously, that testing code doesn't work correct for monomial "-1", because, it reduces that to "-" (like "-1a" should be reduced to "-a")

    So, could you please, check this behaviour and fix it?

    Regards

  • trashy_incel Avatar

    Python fork (author gone)

    • proper use of the test framework
    • random tests (fixing this issue)
  • runningfire Avatar

    Test Passed Test Passed '5ab-c' should equal '-c+5ab' Test monomial length ordering '-abc+3a+2ac' should equal '3a+2ac-abc' 'xyz-xz' should equal '-xz+xyz' Test lexicographic ordering 'a+ac-ab' should equal 'a-ab+ac' 'xyz+byz' should equal 'byz+xyz' Test no leading + '-y+x' should equal 'x-y' 'y-x' should equal '-x+y'

    As for me I solved it.

    UPD

    But Anyways I've come up with it. Just added sorting in some places)))

  • Angelina_Polozhentseva Avatar

    Thank you for this kata! Nice! I've been solving for a long time, but i enjoyed it.

  • Morsala Avatar

    How do I understand which tests were used in the section "More complicated tests"? Otherwise I won't understand how to fix the code. All other tests are solved correctly.

  • VictorGavo Avatar

    One of the test cases is looking for -c+5ab but the instructions say:

    All monomials appears in order of increasing number of variables, e.g.: "-abc+3a+2ac" -> "3a+2ac-abc", "xyz-xz" -> "-xz+xyz"

  • zLuki Avatar

    Great kata! Loved it

  • akar-0 Avatar
  • jojimene85 Avatar

    I've tried my code in Anaconda, working perfect. When I run the tests here, some messages appear saying it is not correctly ordered or whatever.. anybody know what could be going on?

  • bilal_yusuf Avatar

    I've passed all the test and most of the attempts but i keep getting an error with the random tests

  • sid114 Avatar
  • user5257673 Avatar

    This comment has been hidden.

  • akar-0 Avatar

    Rust translation (author is inactive).

  • jopa13131234 Avatar

    Log 32a+b-ab+4ac Sorry :( : '32a+b-ab+4ac' should equal '4a+b-ab+4ac'

  • Armind04 Avatar

    quite a challenge, but an enjoyed after passed

  • Joec05 Avatar

    my solution might be too long but i passed at least

  • efemantarci Avatar

    This kata was awesome

  • akar-0 Avatar

    In Haskell the test logs should provide the input, at least in case of fails.

  • user3818881 Avatar

    Random tests in Haskell sometimes generate cases with constants:
    [("abcy",-14),("",-8),("axyz",-9),("bcdz",-3)],
    or with coefficients equal to zero:
    [("abz",15),("abcx",10),("adx",-6),("abcdxyz",9),("axz",0),("abc",3)].
    It makes the task more fun, but it contradicts the rules laid down in the description:

    the string in input is restricted to represent only multilinear non-constant polynomials.

    I'd suggest either changing the description or fixing random tests.

  • user9644768 Avatar

    Ruby 3.0 should be enabled.

  • Yuki-Yang Avatar

    Help me, please. My code return: Sorry :( : '4a-2a+b-ab+4ac' should equal '4a+b-ab+4ac' But why? 4a-2a = 2a, not 4a...

  • mauro-1 Avatar

    This comment has been hidden.

  • xruzzz Avatar

    Haskell GHC 8.2

    Случайный тест задания генерирует ошибочные строки - генерирует вместе знаки '-' и '+', видимо пропускает ("",1)

    1,

    [("cy",3),("adxyz",12),("abcxy",4),("abx",11),("abdxy",-5),("acy",1),("abcd",4),("abdx",11),("bxy",-10),("cdxyz",4),("bcdxyz",5),("bcyz",-1),("bdxy",1),("",1),("x",-4),("abcy",-10),("cd",-9),("bdxy",15),("z",-8),("abcy",-10),("bxz",-4),("xy",-2),("xz",-8),("abcdxyz",-10),("adxyz",-10),("abdxz",11),("bcdyz",-5),("bdxy",3),("bcdz",-12),("acy",-9),("acy",-13),("bcz",2),("abcdx",-6),("adxy",-10),("bcdx",0),("xyz",-13),("acxy",12),("bcd",-2),("z",-15),("acdyz",-6)]

    ожидает получить результат

    "-c+13x+12z+10by-6dz+9xz-7abx-acz-7bcz-25bdy+15cyz+2abcd-2abdx-13abyz-bcdx-cxyz+2dxyz+8abcdz+abcxz+13abdxy-9abdxz-6bcxyz-13abcdxy"

    2,

    [("acz",-1),("abcdxy",-13),("abdxy",13),("abx",-7),("",1),("abdxz",-9),("bcz",-6),("abcxz",1),("bdy",-13),("c",-1),("x",13),("abcd",2),("dz",-6),("z",12),("bcz",-1),("abdx",-2),("bcdx",-1),("abyz",-13),("bdy",-12),("abcdz",8),("cxyz",-1),("dxyz",2),("by",10),("bcxyz",-6),("xz",9),("cyz",15)]

    генерирует

    "-acz-13abcdxy+13abdxy-7abx+-9abdxz-6bcz+abcxz-13bdy-c+13x+2abcd-6dz+12z-bcz-2abdx-bcdx-13abyz-12bdy+8abcdz-cxyz+2dxyz+10by-6bcxyz+9xz+15cyz"

    ожидает получить результат

    "-c+13x+12z+10by-6dz+9xz-7abx-acz-7bcz-25bdy+15cyz+2abcd-2abdx-13abyz-bcdx-cxyz+2dxyz+8abcdz+abcxz+13abdxy-9abdxz-6bcxyz-13abcdxy"

    3,

    [("y",-9),("bcdxz",14),("acd",-10),("bx",-13),("by",10),("bx",-8),("abcdy",-8),("x",15),("ayz",4),("axz",-14),("abcyz",-2),("abcxz",-15),("acyz",-7),("abz",-9),("by",-14),("abdxz",11),("cdy",1),("abcy",2),("dx",-15),("bz",-13),("xyz",7),("cz",2),("abcd",-11),("acxz",9),("abx",7),("acyz",-13),("bz",8),("acdxyz",-14),("abcyz",-4),("acz",14),("ay",-10),("ab",-9),("acdxy",-11),("abdx",11),("abz",9),("cxz",-10),("abxz",12),("adxyz",7),("cdxz",-13),("bxz",-5),("cyz",8),("acdxy",-15),("bcdyz",4),("acdy",-8),("bcyz",-13),("",1),("abcd",4),("abdxz",-3),("acdxz",10)]

    генерирует

    "-9y+14bcdxz-10acd-13bx+10by-8bx-8abcdy+15x+4ayz-14axz-2abcyz-15abcxz-7acyz-9abz-14by+11abdxz+cdy+2abcy-15dx-13bz+7xyz+2cz-11abcd+9acxz+7abx-13acyz+8bz-14acdxyz-4abcyz+14acz-10ay-9ab-11acdxy+11abdx+9abz-10cxz+12abxz+7adxyz-13cdxz-5bxz+8cyz-15acdxy+4bcdyz-8acdy-13bcyz++4abcd-3abdxz+10acdxz"

    ожидает получить результат

    "15x-9y-9ab-10ay-21bx-4by-5bz+2cz-15dx+7abx-10acd+14acz-14axz+4ayz-5bxz+cdy-10cxz+8cyz+7xyz-7abcd+2abcy+11abdx+12abxz-8acdy+9acxz-20acyz-13bcyz-13cdxz-8abcdy-15abcxz-6abcyz+8abdxz-26acdxy+10acdxz+7adxyz+14bcdxz+4bcdyz-14acdxyz"

    4,

    [("az",8),("abxz",-13),("a",2),("abx",8),("abcdxyz",-5),("cz",10),("bcdxy",-6),("axz",1),("z",-6),("acz",-10),("abdy",-10),("",1),("ayz",8),("xz",-2),("bcd",3),("bcd",9),("abxyz",-8),("abxy",-4),("abx",-14),("bcdz",-14),("cdxy",-5),("",-5),("adz",-5),("bdy",-5),("d",-9),("adxz",5),("abxz",1),("abcdyz",10),("dy",-10),("bcdxy",14),("ay",14),("abcxy",-5),("acdy",-15),("ax",-6),("bdxyz",-9)]

    генерирует

    "+8az-13abxz+2a+8abx-5abcdxyz+10cz-6bcdxy+axz-6z-10acz-10abdy++8ayz-2xz+3bcd+9bcd-8abxyz-4abxy-14abx-14bcdz-5cdxy-5-5adz-5bdy-9d+5adxz+abxz+10abcdyz-10dy+14bcdxy+14ay-5abcxy-15acdy-6ax-9bdxyz"

    ожидает получить результат

    "-4+2a-9d-6z-6ax+14ay+8az+10cz-10dy-2xz-6abx-10acz-5adz+axz+8ayz+12bcd-5bdy-10abdy-4abxy-12abxz-15acdy+5adxz-14bcdz-5cdxy-5abcxy-8abxyz+8bcdxy-9bdxyz+10abcdyz-5abcdxyz"

    5,

    [("a",-15),("bxyz",-5),("bc",3),("",-1),("bcz",2),("bcxy",-6),("by",-15),("b",9),("bcdyz",-15),("bcdxz",-11),("abcdxyz",6),("bcdxz",-5),("ax",-1),("dxyz",-3),("abcyz",1),("ay",-13),("a",2),("abdxyz",4),("cdxyz",4),("abcxz",-12),("cd",-8),("abcdxyz",7),("axyz",-11),("xyz",-5),("bcxy",-10),("yz",7),("adyz",-2),("abyz",10),("bdz",-10),("cdyz",-12),("cdz",-11),("adxz",-5),("abcdx",8),("cx",-13),("bcxyz",2),("acdx",-11),("abcyz",4),("dxyz",11),("acx",-6),("y",-11),("abdxyz",0),("bz",2),("bcy",-12),("adz",-15),("x",3),("bcx",-6),("dxyz",-14),("cdy",5),("abxy",-9),("bcdz",-9),("cdx",-1),("b",14),("acxz",10),("abcdxz",-1),("cd",-3),("bxy",8),("xyz",-15),("xyz",-4)]

    генерирует

    "-15a-5bxyz+3bc-+2bcz-6bcxy-15by+9b-15bcdyz-11bcdxz+6abcdxyz-5bcdxz-ax-3dxyz+abcyz-13ay+2a+4abdxyz+4cdxyz-12abcxz-8cd+7abcdxyz-11axyz-5xyz-10bcxy+7yz-2adyz+10abyz-10bdz-12cdyz-11cdz-5adxz+8abcdx-13cx+2bcxyz-11acdx+4abcyz+11dxyz-6acx-11y-0abdxyz+2bz-12bcy-15adz+3x-6bcx-14dxyz+5cdy-9abxy-9bcdz-cdx+14b+10acxz-abcdxz-3cd+8bxy-15xyz-4xyz"

    ожидает получить результат

    "--13a+23b+3x-11y-ax-13ay+3bc-15by+2bz-11cd-13cx+7yz-6acx-15adz-6bcx-12bcy+2bcz-10bdz+8bxy-cdx+5cdy-11cdz-24xyz-9abxy+10abyz-11acdx+10acxz-5adxz-2adyz-11axyz-9bcdz-16bcxy-5bxyz-12cdyz-6dxyz+8abcdx-12abcxz+5abcyz-16bcdxz-15bcdyz+2bcxyz+4cdxyz-abcdxz+4abdxyz+13abcdxyz"

    6,

    [("yz",9),("",-1)]

    возможно генерирует правильно

    ожидает

    "-+9yz"

  • OneOf99 Avatar

    One of the python test cases starts with a +, which seems to go against the rules that any leading + on a polynomial will be hidden.

  • mattcopp Avatar

    The random tests in Haskell sometimes contain the substring "--"

  • gmanley253 Avatar

    One of the python tests is not correct.

    Sorry :( : '6a+b-ab+4ac+bc-aabc' should equal '4a+b-ab+4ac'

    a * a * b * c = a^2 * b * c. To get 4a+b-ab+4ac' the test should be '6a+b–ab+4ac+bc-2a-bc'

  • cohetillo Avatar

    This comment has been hidden.

  • DunetsNM Avatar

    My first reaction was to suggest to enable Haskell 8.2.2 because 7.10.3 doesn't have regex modules available, but that forced me to get my hands dirty with some Parsec and it was a good fun :)

  • justbrody Avatar

    Test.assertEquals(simplify("dc+dcba"), "cd+abcd")

    I keep getting Expected: 'cd+abcd', instead got: 'abcd+cd', what am I missing?

  • xenobe Avatar

    This comment has been hidden.

  • ArminBlaze Avatar

    Still incorrect expected output for randomised test in JS version of kata sometimes when we have 0 koef in input.

    For example,

    Input +1za+5z-5azb+1za+8z-12z+8zab-2az-3baz
    Expected output z+0abz
    But should be z
    
  • Godo Avatar

    Hi, I see that people are complaining about Haskell tests. But they don't seem to say if this bugs are restraining them from passing the kata (or are those bugs only hapening sometimes) As I have problems too... So, I'd like to know if anyone has passed this kata in Haskell ?

  • SleepingCode Avatar

    Hi everyone, I'm the author of the original version of the kata (python). I'm sorry to known that there are issues with the random tests for the other languages... apparently, codewars don't warn the authors of other versions...

  • benru89 Avatar

    Expected: '4a+b-ab+4ac' How is that b comes before ab in lexicografical order?

  • nomennescio Avatar

    Bugs in random tests for Haskell: sometimes expected value starts with "--.....", which is clearly wrong.

  • chenyulue Avatar

    It is frustrated sometimes when all the test are passed except the random test without the specific test input. Why not giving the specific case, not just Expected, Anctual and something like [("abcdxyz",0),("c",8),("bd",14)...] that helps little to find the bug in my code.

  • krajoli Avatar

    Haskell version: I only see expected and actual. How do I see what the input is which is generating this simplified expression?

  • lhbrennan Avatar

    In Javascript, all the standard tests pass, but all the random tests give me an error along the lines of:

    Expected: '-4b+11bx-19bxz', instead got: '-4b+11bx-19bxz+function (){\n var i=this.length,j,k;\n for (;i;){\n j=Math.floor(Math.random()*this.length);\n k=this[--i];this[i]=this[j];this[j]=k;\n }\n return this;\n}shuffle'

    When I replicate these random tests in something like codepen.io, I get the correct answer every time.

  • cmkay56 Avatar

    Hi I fail one of the tests with this message: Sorry :( : '-3n+10hn-6hjn-8hjnt' should equal '-2n+2hjn+hjnt'

    Doesn't make much sense to me. Can you help?

    Chris

  • Luminux Avatar

    Looks way simpler than it really is. Really enjoyed this one despite being stuck for over an hour as a result of speeding through the details.

  • dvillar Avatar

    Test don't apply the next rules:

    • All monomials appears in order of increasing number of variables.
    • If two monomials have the same number of variables, they appears in lexicographic order.
  • ran81 Avatar

    PHP random tests seem to be off as well.

    For: -12dy+9yzd-9dyz-13y+8y-1-11yd+15yd+9y it expects: 4y-8dy-10dyz

    The "1" term should not be there according to the description and the test result makes no sense as a result.

  • markpearse Avatar

    Still some bugs in the random tests of the Haskell version.

    eg 1) expected: "-+14c+11x... due to a ("",-1) term

    eg 2) expected: "z-6ab-9ac... but there was an (uncancelled) ("",1) term present.

    Happily, random test cases are random, so two presses later I had clean green.

  • cyril-lemaire Avatar

    Very good little kata ty very much :D

  • DiegoBao Avatar

    In JavaScript all the Random test gives me the next error:

    ```TypeError: Cannot read property 'toString' of undefined at simplify at Test.it._ at begin at Object.it at Test.describe._ at /runner/frameworks/javascript/cw-2.js:159:11 at Promise._execute at Promise._resolveFromExecutor at new Promise at Object.describe at Object.handleError at ContextifyScript.Script.runInThisContext at Object.exports.runInThisContext

    The regular tests work fine and tyring one of the random the algorithm also work... So it must be something about the random tests generator.

  • gonyolac Avatar

    Ruby: Random Tests return incorrect expected values:

    one example: Testing for +7dy+12d-14d ✘ It should work for random inputs too - Expected: "26d+7dy", instead got: "-2d+7dy"

  • user9057704 Avatar

    Haskell: I still get something like "-+4ab" in random tests. I would suggest to give up random tests. If you want to prepare unit test with really hardcore case you should invent it and hardcode. Writing tests that compare result with implementation written by someone else is a very bad approach. You should compare the result to well known and manually validated value.

  • haugk Avatar

    Haskell

    I enjoyed this kata. Thank you.

  • wilulako Avatar

    Regarding Haskell tests, your showMember function returns wrong result on constant values ("", 1) and ("", -1). Namely, your showMember ("", 1) returns "+" but it should be "+1".

    In a full example, let xs = [("x", 1), ("", 1)], then your code gives simplify' xs == "x"

  • bhiziroglu Avatar

    I don't understand why the result should be 'x-y'

    In the description, it says that there is no restriction for '-' sign.

    The error I'm facing is: '-y+x' should equal 'x-y'

  • user2765277 Avatar

    I need a bit of help!

    With the random input "-3cyd+14cdy+8d+2d-11cyd-6yd-5d-4d" I get the message "It should work for random inputs too - Expected: "d-6dy+6cdy", instead got: "d-6dy"" Its a bug in the random imput generation?

  • terminus_technicus Avatar

    Yep, that 'PolynomialSimplifier' class was a rude one. If the description says "write a function", I do not necessarily imply to "write a method". Description could have been cleaner; I could have produced a non-fake OO solution.

  • bobtrigg Avatar

    I got the same Class 'PolynomialSimplifier' not found error. Could you please let me know how to get this resolved? It's a killer kata and I'd like to see some other solutions!

  • kolossa Avatar

    Hi,

    The test_random gives me: Error: Class 'PolynomialSimplifier' not found

    Please could you check?

  • j-martyn Avatar

    Incorrect expected output for randomised test in JS version of kata sometimes when we have 0 koef in input.

    For example,

    • Input xz-0bz
    • Expected output -0bz+xz
    • But should be xz
  • jgdodson Avatar

    A goodie!

  • 漫游午后 Avatar

    why I have this error test_random Error: Class 'PolynomialSimplifier' not found

  • matthewmoppett Avatar

    The Haskell translation of this kata has some errors in the random tests. Some examples of the tests that I've been failing include:

    • Input expressions containing sequences such as "2adz-+13bcd", "15bxyz--12cdxy", "6acdz++14bdz", and "+3abdz-10cz-0bcdxzi" (at the beginning of the input string).
    • Occasional "expected output" errors: one expected output string began with "--3x-ab-8bx", another with "-+4ab-2ay-2dz"

    It would be great if we could get this fixed.

  • Blind4Basics Avatar

    I spent A LOT of time on your kata, even after I solved it... ;-)

    I made a version which can handle coefficients without variables, coefficients greater than 10 and variables with exponents (syntaxes allowed : ** or ^ ; but exponents have to be positives and written without brackets).

    It might be interresting to confront it with others answers. Would like to create a harder version of the kata ?

    It could be interesting to link those two (like SteffenVogel_79 did with his encryption problems : https://www.codewars.com/kata/57814d79a56c88e3e0000786 )

    Thanks for this problem !

  • Blind4Basics Avatar

    Well, me again... While checking my code to improve it, I discovered it is actually wrong ! But it passes the tests all the same !

    I suggest you implement some tests with coefficients bigger than 10 (in the previous version of my code, I inverted the strings so 31 becomes 13...)

  • Blind4Basics Avatar

    Hello,

    I encounter an error with the first of the "more complicated tests" but I don't have any clue of what's going on. Message error is :

    "Traceback: in in simplify KeyError: 'c' "

    How can I find what'going on, please ?

    EDIT : well, the problem is in fact : how can I know what is exactly the test, in order to understand what cause the error with the key 'c' of my dict ?

  • pizzx Avatar

    My solution can't pass the last testcase and I don't know what's going wrong there??

    More complicated tests [('a', 3), ('a', 3), ('a', 31), ('a', 31), ('ab', -1), ('ac', 4), ('b', 1), ('bc', 1), ('bc', -1)] ✘ Sorry :( : '68a+b-ab+4ac' should equal '4a+b-ab+4ac'

  • BrinstarBeast Avatar

    Great kata! I'm kind of a novice with programming, but after 2 days of working on this, finally got it. Very rewarding and a good learning experience... trying to get a computer to do simple algebra.

  • lukophron Avatar

    This comment has been hidden.

  • eralde Avatar

    Great kata, but my solution crashes on the advanced tests section with a strange error:

    Advanced tests static ones PatternMatchFail (/tmp/haskell11663-13-305v6j/Codewars/Kirilloid/MultilinearPolynomials.hs:(20,1)-(22,43): Non-exhaustive patterns in function modMonomail)

    What can I do to get more information on the cause of the test failure? Thanks in advance!

  • smile67 Avatar

    Good one, so thanks to "@SleepingCode". It's a really good exercise for Ruby newbies (like me;-)) - enjoyed to solve it;-)!

  • obszczymucha Avatar

    It seems there's something wrong with the hidden tests. I was getting random failures like (notice the "-+" in the expected string, which seems to me like an invalid thing):

    Falsifiable (after 58 tests): expected: "-+5b+6x-17ad+cx-cy-10dz-5abd-8aby+6acx-acz+12adz-15bcy-5bcz-8byz-9cdy+6cxz-cyz-14abcd-abcy-18abdy+4abyz-12acdz-14acxz-5acyz+adxy+9bcdy-5bcxy-10bcxz-8bcyz+11bdxy+4cdxy-15cdyz+8dxyz-2abcdz-14abcxy+11abdxy-12abdyz-7adxyz-2bcdxz-10bcdyz-4bdxyz+7abdxyz-7abcdxyz"

  • andreamazza89 Avatar

    That took me a while, nice kata!

  • munyari Avatar

    Good kata, just a few spelling and grammatical issues. The title should be "Simplifying multilinear polynomials". There are also a few grammatical issues in the description that I can point out, if you'd like.

  • RobinKnipe Avatar

    Yep, as your description says that was more difficult than expected.

    Have you considered the following scenarios in your tests?

    • constants, e.g. simplify('7-3x+4') -> 3-3x
    • non-simplified factors, e.g. simplify('3c4a2b') -> 24abc
  • lcarter@marketpath.com Avatar

    This is a really fun kata and I enjoyed solving it. My only issue was that I ran into an intermittent bug with the random test cases in Javascript. Based on my understanding of the kata, I believe my solution should have been valid (and my solution passed after re-submitting it immediately after). I copied the test case output from a failed test to help in fixing it:

    Testing for -0xb+0xbc+15x It should work for random inputs too - Expected: 15x+0bcx, instead got: 15x

    Thanks, and keep up the great work!

  • GiPreduuzie Avatar

    Sorry, I think there are some invalid tests for this kata. That's what I recieve, trying to submit it:

    expected: "-+12a-7cz-15dx+11xz+9abx-12ady-3axy+11bcd-4bcxz-7cdyz+9abdxyz" but got: "-12a-7cz-15dx+11xz+9abx-12ady-3axy+11bcd-4bcxz-7cdyz+9abdxyz" [("cdyz",-7),("dx",-15),("cz",-7),("abx",9),("bcd",11),("",-1),("a",12),("bcxz",-4),("xz",11),("abdxyz",9),("axy",-3),("ady",-12)]

    Also, behaviour with constant is not clear: in task definition we've been told that there would be no free constans, but test seem to generate examples with them and expect the program to filter them out, so input "2+a" have to be converted to "a". Correct me if I wrong :)

  • GiacomoSorbi Avatar

    Kata approved :)

  • GiacomoSorbi Avatar

    First of all: thanks for the kata that I entirely enjoyed and upvoted with pleasure :)

    I would recommend putting some extra edge case and a neat suite of random tests (I would gladly do that for you, in case you are interested).

    Finally, translated it into both JS and Ruby, if you want to integrate them, so that many more users will be able to solve it :)

    [Of course any possible issue with such a complex parsing kata is all my fault and for any trouble in the JS and Ruby version, just post under this comment so that I can be notified and fix it in time]