text: Pairs of complete strings in two sets of strings | C # implementation for find pairs of complete strings . ; Returns count of complete pairs from set [ 0. . n - 1 ] and set2 [ 0. . m - 1 ] ; Consider all pairs of both strings ; Create a concatenation of current pair ; Compute frequencies of all characters in the concatenated String . ; If frequency of any character is not greater than 0 , then this pair is not complete . ; Driver code
code: using System ; class GFG { static int countCompletePairs ( string [ ] set1 , string [ ] set2 , int n , int m ) { int result = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { string concat = set1 [ i ] + set2 [ j ] ; int [ ] frequency = new int [ 26 ] ; for ( int k = 0 ; k < concat . Length ; k ++ ) { frequency [ concat [ k ] - ' a ' ] ++ ; } int l ; for ( l = 0 ; l < 26 ; l ++ ) { if ( frequency [ l ] < 1 ) { break ; } } if ( l == 26 ) { result ++ ; } } } return result ; } static public void Main ( ) { string [ ] set1 = { " abcdefgh " , " geeksforgeeks " , " lmnopqrst " , " abc " } ; string [ ] set2 = { " ijklmnopqrstuvwxyz " , " abcdefghijklmnopqrstuvwxyz " , " defghijklmnopqrstuvwxyz " } ; int n = set1 . Length ; int m = set2 . Length ; Console . Write ( countCompletePairs ( set1 , set2 , n , m ) ) ; } }