You are given an array A of length N. The partial digit subsequence of an array A is a subsequence of integers in which each consecutive integers have at least 1 digit in common. You are required to find the length of longest partial digit subsequence from the given array.
Input :
Output :
Constraints :
The longest partial digit subsequence of the given array is [12, 23]. as 12 and 23 contain 2 as the common digit.