#include using namespace std; #include using namespace atcoder; using ll = int64_t; using ul = uint64_t; using ld = long double; using vi = vector; using vc = vector; using vs = vector; using vb = vector; using vl = vector; using vvi = vector; using vvc = vector; using vvb = vector; using vvl = vector; using mint = modint998244353; using vm = vector; int main() { string X,Y,Z; cin >> X >> Y >> Z; int xs = X.size(),ys = Y.size(),zs = Z.size(); set cnt; string x = ""; for (int i = 0; i < xs; i++) { x += X[i]; string y = ""; for (int j = 0; j < ys; j++) { y += Y[j]; string z = ""; for (int k = 0; k < zs; k++) { z += Z[k]; cnt.insert(x + y + z); cnt.insert(x + z + y); cnt.insert(y + x + z); cnt.insert(y + z + x); cnt.insert(z + x + y); cnt.insert(z + y + x); } } } cout << cnt.size() << endl; return 0; }