#include using namespace std; typedef long long ll; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b>N>>M; if(N>2){ cout<<0< SE; string A,B;cin>>A>>B; string S=A+A[0]; if(S.substr(1)==B){ SE.insert(S); } string T=B+B[0]; if(T.substr(1)==A){ SE.insert(T); } cout<