The program to count the common sub-sequence of two strings is discussed here. Given two strings, count all the common sub-sequences of the two strings and print them.
For example,
Input:
string 1 = “abcd”
string 2 = “abc”
Output:
Number of common sub-sequences = 7
Common sub-sequences: ‘a’, ‘b’, ‘c’, ‘ab’, ‘bc’, ‘ac’, ‘abc’.
Input:
String 1 : bajdpmk
String 2 : dimnkc
Output:
Number of common sub-sequences = 7
Common sub-sequences: ‘d’, ‘k’, ‘m’, ‘dk’, ‘km’, ‘dm’, ‘dmk’.
@@coding::1@@
Recommended Programs