> If you've finished this kata, you can try the [more difficult version](https://www.codewars.com/kata/5b256145a454c8a6990000b5).


## Taking a walk
A promenade is a way of uniquely representing a fraction by a succession of “left or right” choices. 

For example, the promenade `"LRLL"` represents the fraction `4/7`.

Each successive choice (`L` or `R`) changes the value of the promenade by combining the values of the
promenade before the most recent left choice with the value before the most recent right choice. If the value before the most recent left choice was *l/m* and the value before the most recent right choice
was r/s then the new value will be *(l+r) / (m+s)*. 

If there has never been a left choice we use *l=1* and *m=0*;  
if there has never been a right choice we use *r=0* and *s=1*.


So let's take a walk.

* `""` An empty promenade has never had a left choice nor a right choice. Therefore we use *(l=1 and m=0)* and *(r=0 and s=1)*.  
So the value of `""` is *(1+0) / (0+1) = 1/1*.
* `"L"`. Before the most recent left choice we have `""`, which equals *1/1*. There still has never been a right choice, so *(r=0 and s=1)*. So the value of `"L"` is *(1+0)/(1+1) = 1/2*
* `"LR"` = 2/3 as we use the values of `""` (before the left choice) and `"L"` (before the right choice)
* `"LRL"` = 3/5 as we use the values of `"LR"` and `"L"`
* `"LRLL"` = 4/7 as we use the values of `"LRL"` and `"L"` 


Fractions are allowed to have a larger than b.


## Your task

Implement the `promenade` function, which takes an promenade as input (represented as a string), and returns 
the corresponding fraction (represented as a tuple, containing the numerator and the denominator).

```Python
promenade("") == (1,1)
promenade("LR") == (2,3)
promenade("LRLL") == (4,7)
```
```Java
Return the Fraction as an int-Array:
promenade("") == [1,1]
promenade("LR") == [2,3]
promenade("LRLL") == [4,7]
```


*adapted from the 2016 British Informatics Olympiad*

Difficulty: introductory

Starter code:

def promenade(choices):
	

Solutions:
def promenade(choices):
    
    def compute(): return l+r,m+s
    
    l,m, r,s = 1,0, 0,1
    for c in choices:
        if c=='L': l,m = compute()
        else:      r,s = compute()
        
    return compute()

def promenade(choices):
    l, m = (1, 0)
    r, s = (0, 1)
    for choice in choices:
        if choice == 'L': l, m = l+r, m+s
        elif choice == 'R': r, s = l+r, m+s
    return l+r,m+s


def next(last_l, last_r):
    return last_l[0] + last_r[0], last_l[1] + last_r[1]

def promenade(choices):
    last_l = (1, 0)
    last_r = (0, 1)
    last = None
    
    for c in choices:
        if c == "L":
            last_l = next(last_l, last_r)
        else:
            last_r = next(last_l, last_r)
            
    return next(last_l, last_r)
            
        
    
    
    # good luck!


def promenade(choices):
    x = [(1, 0), (0, 1)] # [(l, m), (r, s)]
    for c in choices:
        x[c == 'R'] = x[0][0] + x[1][0], x[0][1] + x[1][1]
    return x[0][0] + x[1][0], x[0][1] + x[1][1]

def promenade(choices):
    l, m, r = [1, 0], [1, 1], [0, 1]
    for c in choices:
        if c == 'L': l = m[:]
        else: r = m[:]
        m = [l[0]+r[0], l[1]+r[1]]
    return tuple(m)

def promenade(choices):
    if not choices: return (1, 1)
    (a, b) = promenade(choices[1:])
    return (a, a + b) if choices[0] == 'L' else (a + b, b)

def promenade(choices):
    lm=[1,0]
    rs=[0,1]
    ans=[1,1]
    
    for i in choices:
        if i=='L':
            lm=ans[::]
            
        if i=='R':
            rs=ans[::]
        ans=[lm[0]+rs[0],lm[1]+rs[1]]
    return tuple(ans)
    
def fraction_to_promenade(fraction):
    ans=""
    frac=list(fraction)
    while(frac[0]!=frac[1]):
        if frac[0]>frac[1]:
        
            ans+="R"
            frac[0]=frac[0]-frac[1]
        if frac[1]>frac[0]:
            ans+="L"
            frac[1]=frac[1]-frac[0]
    return ans

def promenade(ch):
    
    def evaulate(): return l+r,m+s
    
    l,m, r,s = 1,0, 0,1
    for c in ch:
        if c=='L': l,m = evaulate()
        else:      r,s = evaulate()
        
    return evaulate()

def promenade(choices):
    fraction=(1,1)
    most_recent_L=(1,0)
    most_recent_R=(0,1)
    fraction_add=lambda L, R: tuple( l + r for l, r in zip(L,R))
    for C in choices:
        if C=="L":
            most_recent_L=fraction
            fraction=fraction_add(most_recent_L,most_recent_R)
        elif C=="R": 
            most_recent_R=fraction
            fraction=fraction_add(most_recent_L,most_recent_R)
        else: raise ValueError
    return fraction

def promenade(choices):
    last_left = [1,0]
    last_right = [0,1]
    out = [1,1]
    for choice in choices:
        if choice is 'L':
            last_left = out.copy()
            out[0] += last_right[0]
            out[1] += last_right[1]
        else:
            last_right = out.copy()
            out[0] += last_left[0]
            out[1] += last_left[1]
    return tuple(out)