Help me to solve this

Given two strings.You have to find number of strings of minimum length for which the two strings are subsequence.
For example

String 1-ab

String 2-ba

aba is one of the minimum length string

first find the lcs of string 1 and string 2 say n,

if n==len(string 1) || n==len(string 2)

then the len(larger string) is the answer

else
len(larger string)+len(shorter string)-n;

You have to find the number of strings of minimum length not the minimum length