#include using namespace std; using ll = long long; using P = pair; #define fix(x) fixed << setprecision(x) #define asc(x) x, vector, greater #define rep(i, n) for(ll i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a> n >> m; set se; rep(i,n){ cin >> s; se.insert(s); } if(se.size()>m+1){ cout << 0 << '\n'; return 0; } s = *se.begin(); se.erase(se.begin()); vector p(se.rbegin(), se.rend()); rep(i,m+1){ rep(j,26){ bool b = true; for(auto &t:p){ bool wa = false; rep(k,m+1){ if(i==k) x = 'a' + j; else x = s[k-(i=2) break; } } cout << ans << '\n'; return 0; }