#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); string a,b,c; cin >> a >> b >> c; set S; for(int i=1; i<=a.size(); i++) for(int k=1; k<=b.size(); k++) for(int l=1; l<=c.size(); l++){ string x = a.substr(0,i); string y = b.substr(0,k); string z = c.substr(0,l); S.insert(x+y+z); S.insert(x+z+y); S.insert(y+x+z); S.insert(y+z+x); S.insert(z+x+y); S.insert(z+y+x); } cout << S.size() << endl; }