#include #include #include bool isIsomorphic( const std::string & myA, const std::string & myB ) { if ( myA.length( ) != myB.length( )) { return false ; } else { std::map mapped_from ; std::map mapped_to ; for ( int i = 0 ; i < myA.length( ) ; i++ ) { mapped_from[myA[i]] = myB[i] ; mapped_to[myB[i]]++ ; } return mapped_from.size( ) == mapped_to.size( ) ; } } int main( int argc, char * argv[] ) { if ( argc != 3 ) { std::cerr << "Usage \n" ; return 1 ; } else { std::string myA( argv[ 1 ] ) ; std::string myB( argv[2] ) ; if ( isIsomorphic( myA , myB ) ) std::cout << 1 << std::endl ; else std::cout << 0 << std::endl ; return 0 ; } }