title: Length of Longest Common sequence Python recursive function
body: <p>I am trying to implement this function with recursion in python and I have a mistake. I can't understand what is the mistake, could you help me? </p>
  
  <p>The code: </p>
  
  <pre><code>def LongestCommonSubsequence(X,Y,tailX,tailY):
      if tailX == tailY and tailX!='' and (X=='' or Y==''):
              return len(tailX)
      elif X=='' or Y=='':
              return 0
      else:
  
          return max( LongestCommonSubsequence(X[1:],Y[1:],tailX+X[0],tailY+Y[0]),
                      LongestCommonSubsequence(X[1:],Y[1:],tailX+X[0],tailY),
                      LongestCommonSubsequence(X[1:],Y[1:],tailX,tailY+Y[0]),
                      LongestCommonSubsequence(X[1:],Y[1:],tailX,tailY)) 
  
  X=raw_input() 
  Y=raw_input() 
  print LongestCommonSubsequence(X,Y,'','')
  </code></pre>
  
  <p>input: </p>
  
  <pre><code>abccdabab 
  bacdbeb 
  </code></pre>
  
  <p>expected output:5<br>
  what i get:4</p>