Function to return the count of common divisors
static int countCommonDivisors ( string a , string b ) { int ct = 0 ; int n = a . Length , m = b . Length ; for ( int i = 1 ; i <= Math . Min ( n , m ) ; i ++ ) {