C # program to print all the strings that match the given pattern where every character in the pattern is uniquely mapped to a character in the dictionary
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static bool check ( string pattern , string word ) { if ( pattern . Length != word . Length ) return false ; int [ ] ch = new int [ 128 ] ; int Len = word . Length ; for ( int i = 0 ; i < Len ; i ++ ) { if ( ch [ ( int ) pattern [ i ] ] == 0 ) { ch [ ( int ) pattern [ i ] ] = word [ i ] ; } else if ( ch [ ( int ) pattern [ i ] ] != word [ i ] ) { return false ; } } return true ; }