#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define SZ(x) ((int)x.size()-1)
#define ms(a,b) memset(a,b,sizeof a)
#define F(i,a,b) for (int i=(a);i<=(b);++i)
#define DF(i,a,b) for (int i=(a);i>=(b);--i)
using namespace std;
inline int read(){
	char ch=getchar(); int w=1,c=0;
	for(;!isdigit(ch);ch=getchar()) if (ch=='-') w=-1;
	for(;isdigit(ch);ch=getchar()) c=(c<<1)+(c<<3)+(ch^48);
	return w*c;
}
int main(){
	int n=read();
	cout<<(1<<n)-1<<"\n";
	F(i,1,(1<<n)-1){
		F(j,0,(1<<n)-1){
			cout<<((__builtin_popcount(i&j)&1)&1 ? 'A' : 'B');
		}
		cout<<"\n";
	}
	return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* DON'T GET STUCK ON ONE APPROACH
*/

#include <bits/stdc++.h>

#define div /

/*
ID: farukde1
TASK: beads
LANG: C++
*/

using namespace std;

int main() {
    ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

    /*
    freopen("input.txt","r",stdin);
    freopen("beads.out","w",stdout);
    */

    string s;
    cin >> s;
    int ans=0;
    for(int i=0; i<=9999; i++){
        bool flag[10]={false};
        int x=i;
        for(int j=0; j<4; j++){
            flag[x%10] = true;
            x=x div 10;
        }
        bool flag2 = true;
        for(int j=0; j<10; j++){
            if(s[j]=='o' && !flag[j]) flag2 = false;
            if(s[j]=='x' && flag[j]) flag2 = false;
        }
        ans+=flag2;
    }
    cout << ans << endl;
}
