#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
const int N=10005,inf=1e7;
int n,m,head[N],cnt=1,T=9999,S=9998,iter[N],dis[N],ex[N],et[N];
bool vis[N];
struct edge{
	int to,nxt,cap,cost;
}e[N*8];
inline int addedge(int u,int v,int cap,int cost){
	e[++cnt]=(edge){v,head[u],cap,cost},head[u]=cnt;
	e[++cnt]=(edge){u,head[v],0,-cost},head[v]=cnt;
	return cnt-1;
}
int dfs(int u,int f){
	if(u==T||!f)return f;
	vis[u]=1;
	int res=0;
	for(int&i=iter[u];i;i=e[i].nxt)
		if(e[i].cap&&dis[e[i].to]==dis[u]+e[i].cost&&!vis[e[i].to]){
			int d=dfs(e[i].to,min(f,e[i].cap));
			if(d){
				res+=d,f-=d;
				e[i].cap-=d,e[i^1].cap+=d;
				if(!f)break;
			}
		}
	vis[u]=0;
	return res;
}
bool MCMF(){
	memset(dis,0x3f,sizeof dis);
	dis[S]=0;
	queue<int>q;
	for(q.push(S);q.size();){
		int u=q.front();
		q.pop();
		vis[u]=0;
		for(int i=head[u];i;i=e[i].nxt)
			if(e[i].cap&&dis[e[i].to]>dis[u]+e[i].cost){
				dis[e[i].to]=dis[u]+e[i].cost;
				if(!vis[e[i].to]){
					vis[e[i].to]=1;
					q.push(e[i].to);
				}
			}
	}
	if(dis[T]>inf)return 0;
	memcpy(iter,head,sizeof iter);
	while(dfs(S,inf));
	return 1;
}
vector<int>G[N];
int sta[2000000],top;
void dfs(int u){
	vis[u]=1;
	for(int i=iter[u];i<(int)G[u].size();i=iter[u]){
		iter[u]=i+1;
		int v=G[u][i];
		dfs(v);
	}
	sta[++top]=u;
}
int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n>>m;
	addedge(S,0,1,0);
	addedge(S,0,inf,1);
	for(int i=0;i<1<<n;++i)
		for(int j=0;j<n;++j)
			if(!(i>>j&1))
				addedge(i,i|1<<j,inf,1);
	for(int ss=0;m--;ss=0){
		char s[30];
		cin>>s;
		for(int i=0;i<n;++i)
			ss|=(int)(s[i]-'0')<<i;
		ex[ss]=addedge(ss,T,1,0);
		et[ss]=addedge(S,ss+3000,1,0);
		for(int j=0;j<n;++j)
			if(!(ss>>j&1))
				addedge(ss+3000,ss|1<<j,1,1);
	}
	while(MCMF());
	for(int i=0;i<1<<n;++i)if(ex[i]){
		if(e[et[i]].cap<1)
			G[i].emplace_back(i+3000);
		else G[i].emplace_back(0);
	}
	for(int u=0;u<1<<n;++u){
		for(int i=head[u];i;i=e[i].nxt)
			if(e[i].to>u&&e[i].to<(1<<n))
				for(int t=inf;t>e[i].cap;--t)
					G[u].emplace_back(e[i].to);
		for(int i=head[u+3000];i;i=e[i].nxt)
			if(e[i].to>u&&e[i].to<(1<<n))
				for(int t=1;t>e[i].cap;--t)
					G[u+3000].emplace_back(e[i].to);
	}
	memset(iter,0,sizeof iter);
	dfs(0);
	reverse(sta+1,sta+top+1);
	vector<char>vc;
	for(int i=1;i<top;++i){
		if(sta[i+1]==sta[i]+3000)
			continue;
		else if(sta[i+1]==0)
			vc.emplace_back('R');
		else{
			int x=sta[i]>3000?sta[i]-3000:sta[i],y=sta[i+1];
			vc.emplace_back('0'+__builtin_ctz(y-x));
		}
	}
	vc.pop_back();
	cout<<vc.size()<<'\n';
	for(char c:vc)
		cout<<c<<' ';
	return 0;
}