# Shortest Common Supersequence

Problem Link: <https://practice.geeksforgeeks.org/problems/shortest-common-supersequence0322/1>

```python
class Solution:
    
    #Function to find length of shortest common supersequence of two strings.
    def shortestCommonSupersequence(self, X, Y, m, n):
        
        dp=[[0 for i in range(n+1)] for j in range(m+1)]
        for i in range(m+1):
            for j in range(n+1):
                if(i==0 or j==0):
                    dp[i][j]=0
                else:
                    if(X[i-1]==Y[j-1]):
                        dp[i][j]=1+dp[i-1][j-1]
                    else:
                        dp[i][j]=max(dp[i-1][j],dp[i][j-1])
        return m+n-dp[m][n]
```
