#include using namespace std; signed main(){ string S; cin >> S; vector< int > cnt( 256 ); for( int i = 0; i < S.size(); ++i ) ++cnt[ S[ i ] ]; vector< int > fcnt; for( int i = 0; i < 256; ++i ) if( cnt[ i ] > 1 ) fcnt.emplace_back( cnt[ i ] ); function< int ( int ) > fact = [ & ]( int x ){ return x == 0 ? 1 : x * fact( x - 1 ); }; int ans = fact( ( int ) S.size() ); for( int i = 0; i < fcnt.size(); ++i ) ans /= fact( fcnt[ i ] ); cout << ans - 1 << endl; return 0; }