3 added 817 characters in body
source | link

I gave it a go. First I simplified your code a little bit.

def the_process(stored, inp, size):
    global thstr
    idx = 0
    idx = stored.index(inp[0])
    if idx:
        the_process(stored[:idx], inp[1:], idx)
    if size - 1 != idx:
        the_process(stored[idx+1:],inp[idx+1:], size - idx - 1)
    thstr.append(inp[0])

Now it looks like by the naming that stored is hardcoded in the binary. I considered MGNCHXWIZDJAOKPELYSFUTV to be as is and the target output to be MNGHCWZIJDXOPKLESUVTFYA.

By the function it looks like that it takes the first char of input, splits stored at the location of that char and then recursively calls itself on the two parts made. I made a tree to follow that.originalinput

The graph is such that taking one char from input TFSLPOJZCGMNHWXIDAKEYUV and position nodes/chars which are at the right/left appropriately(V is right to T in the graph as it is right to T in the stored). In this graph the output is post order traversal of the graph and the input is pre order traversal.

Similar graph can be constructed from the target MNGHCWZIJDXOPKLESUVTFYA. Only the reverse such that post order is given and construct the graph. targetinput

Now pre order traverse this graph and you'll have your input AXCGMNHDIWZJYEKOPLFSTUV.

The equivalent hackish function is this. feel free to make it better.

def rev_process(stored, inp, size):
    if not size:
        return
    global thstr
    mp = {stored[i] : i for i in xrange(len(stored))}
    idx = mp[inp[-1]]
    thstr.append(inp[-1])
    if size == 1:
        return
    try:
        less_part = max(loc for loc, val in enumerate(inp) if mp[val] < idx) + 1
    except ValueError:
        less_part = 0
    rev_process(stored[:idx], inp[:less_part], less_part, fs+1)
    if less_part!= size-1:
        rev_process(stored[idx+1:], inp[less_part:-1], size-less_part-1, fs+1)

I have also added the reversed function code and resources here

I gave it a go. First I simplified your code a little bit.

def the_process(stored, inp, size):
    global thstr
    idx = 0
    idx = stored.index(inp[0])
    if idx:
        the_process(stored[:idx], inp[1:], idx)
    if size - 1 != idx:
        the_process(stored[idx+1:],inp[idx+1:], size - idx - 1)
    thstr.append(inp[0])

Now it looks like by the naming that stored is hardcoded in the binary. I considered MGNCHXWIZDJAOKPELYSFUTV to be as is and the target output to be MNGHCWZIJDXOPKLESUVTFYA.

By the function it looks like that it takes the first char of input, splits stored at the location of that char and then recursively calls itself on the two parts made. I made a tree to follow that.originalinput

The graph is such that taking one char from input TFSLPOJZCGMNHWXIDAKEYUV and position nodes/chars which are at the right/left appropriately(V is right to T in the graph as it is right to T in the stored). In this graph the output is post order traversal of the graph and the input is pre order traversal.

Similar graph can be constructed from the target MNGHCWZIJDXOPKLESUVTFYA. Only the reverse such that post order is given and construct the graph. targetinput

Now pre order traverse this graph and you'll have your input AXCGMNHDIWZJYEKOPLFSTUV.

I gave it a go. First I simplified your code a little bit.

def the_process(stored, inp, size):
    global thstr
    idx = 0
    idx = stored.index(inp[0])
    if idx:
        the_process(stored[:idx], inp[1:], idx)
    if size - 1 != idx:
        the_process(stored[idx+1:],inp[idx+1:], size - idx - 1)
    thstr.append(inp[0])

Now it looks like by the naming that stored is hardcoded in the binary. I considered MGNCHXWIZDJAOKPELYSFUTV to be as is and the target output to be MNGHCWZIJDXOPKLESUVTFYA.

By the function it looks like that it takes the first char of input, splits stored at the location of that char and then recursively calls itself on the two parts made. I made a tree to follow that.originalinput

The graph is such that taking one char from input TFSLPOJZCGMNHWXIDAKEYUV and position nodes/chars which are at the right/left appropriately(V is right to T in the graph as it is right to T in the stored). In this graph the output is post order traversal of the graph and the input is pre order traversal.

Similar graph can be constructed from the target MNGHCWZIJDXOPKLESUVTFYA. Only the reverse such that post order is given and construct the graph. targetinput

Now pre order traverse this graph and you'll have your input AXCGMNHDIWZJYEKOPLFSTUV.

The equivalent hackish function is this. feel free to make it better.

def rev_process(stored, inp, size):
    if not size:
        return
    global thstr
    mp = {stored[i] : i for i in xrange(len(stored))}
    idx = mp[inp[-1]]
    thstr.append(inp[-1])
    if size == 1:
        return
    try:
        less_part = max(loc for loc, val in enumerate(inp) if mp[val] < idx) + 1
    except ValueError:
        less_part = 0
    rev_process(stored[:idx], inp[:less_part], less_part, fs+1)
    if less_part!= size-1:
        rev_process(stored[idx+1:], inp[less_part:-1], size-less_part-1, fs+1)

I have also added the reversed function code and resources here

2 added 2 characters in body
source | link

I gave it a go. First I simplified your code a little bit.

def the_process(stored, inp, size):
    global thstr
    idx = 0
    idx = stored.index(inp[0])
    if idx:
        the_process(stored[:idx], inp[1:], idx)
    if size - 1 != idx:
        the_process(stored[idx+1:],inp[idx+1:], size - idx - 1)
    thstr.append(inp[0])

Now it looks like by the naming that stored is hardcoded in the binary. I considered MGNCHXWIZDJAOKPELYSFUTV to be as is and the target output to be MNGHCWZIJDXOPKLESUVTFYA.

By the function it looks like that it takes the first char of input, splits stored at the location of that char and then recursively calls itself on the two parts made. I made a tree to follow that.originalinput

The graph is such that taking one char from input TFSLPOJZCGMNHWXIDAKEYUV and position nodes/chars which are at the right/left appropriately(V is leftright to T in the graph as it is leftright to T in the stored). In this graph the output is post order traversal of the graph and the input is pre order traversal.

Similar graph can be constructed from the target MNGHCWZIJDXOPKLESUVTFYA. Only the reverse such that post order is given and construct the graph. targetinput

Now pre order traverse this graph and you'll have your input AXCGMNHDIWZJYEKOPLFSTUV.

I gave it a go. First I simplified your code a little bit.

def the_process(stored, inp, size):
    global thstr
    idx = 0
    idx = stored.index(inp[0])
    if idx:
        the_process(stored[:idx], inp[1:], idx)
    if size - 1 != idx:
        the_process(stored[idx+1:],inp[idx+1:], size - idx - 1)
    thstr.append(inp[0])

Now it looks like by the naming that stored is hardcoded in the binary. I considered MGNCHXWIZDJAOKPELYSFUTV to be as is and the target output to be MNGHCWZIJDXOPKLESUVTFYA.

By the function it looks like that it takes the first char of input, splits stored at the location of that char and then recursively calls itself on the two parts made. I made a tree to follow that.originalinput

The graph is such that taking one char from input and position nodes/chars which are at the right/left appropriately(V is left to T in the graph as it is left to T in the stored). In this graph the output is post order traversal of the graph and the input is pre order traversal.

Similar graph can be constructed from the target MNGHCWZIJDXOPKLESUVTFYA. Only the reverse such that post order is given and construct the graph. targetinput

Now pre order traverse this graph and you'll have your input AXCGMNHDIWZJYEKOPLFSTUV.

I gave it a go. First I simplified your code a little bit.

def the_process(stored, inp, size):
    global thstr
    idx = 0
    idx = stored.index(inp[0])
    if idx:
        the_process(stored[:idx], inp[1:], idx)
    if size - 1 != idx:
        the_process(stored[idx+1:],inp[idx+1:], size - idx - 1)
    thstr.append(inp[0])

Now it looks like by the naming that stored is hardcoded in the binary. I considered MGNCHXWIZDJAOKPELYSFUTV to be as is and the target output to be MNGHCWZIJDXOPKLESUVTFYA.

By the function it looks like that it takes the first char of input, splits stored at the location of that char and then recursively calls itself on the two parts made. I made a tree to follow that.originalinput

The graph is such that taking one char from input TFSLPOJZCGMNHWXIDAKEYUV and position nodes/chars which are at the right/left appropriately(V is right to T in the graph as it is right to T in the stored). In this graph the output is post order traversal of the graph and the input is pre order traversal.

Similar graph can be constructed from the target MNGHCWZIJDXOPKLESUVTFYA. Only the reverse such that post order is given and construct the graph. targetinput

Now pre order traverse this graph and you'll have your input AXCGMNHDIWZJYEKOPLFSTUV.

1
source | link

I gave it a go. First I simplified your code a little bit.

def the_process(stored, inp, size):
    global thstr
    idx = 0
    idx = stored.index(inp[0])
    if idx:
        the_process(stored[:idx], inp[1:], idx)
    if size - 1 != idx:
        the_process(stored[idx+1:],inp[idx+1:], size - idx - 1)
    thstr.append(inp[0])

Now it looks like by the naming that stored is hardcoded in the binary. I considered MGNCHXWIZDJAOKPELYSFUTV to be as is and the target output to be MNGHCWZIJDXOPKLESUVTFYA.

By the function it looks like that it takes the first char of input, splits stored at the location of that char and then recursively calls itself on the two parts made. I made a tree to follow that.originalinput

The graph is such that taking one char from input and position nodes/chars which are at the right/left appropriately(V is left to T in the graph as it is left to T in the stored). In this graph the output is post order traversal of the graph and the input is pre order traversal.

Similar graph can be constructed from the target MNGHCWZIJDXOPKLESUVTFYA. Only the reverse such that post order is given and construct the graph. targetinput

Now pre order traverse this graph and you'll have your input AXCGMNHDIWZJYEKOPLFSTUV.