install.packages("combinat");
library(combinat);
data<-NULL;
data<-rbind(data,t(data.frame(permn(c("a","b","b","b","b")))));
data<-rbind(data,t(data.frame(permn(c("a","a","a","a","b")))));
data<-rbind(data,t(data.frame(permn(c("a","a","b","b","b")))));
data<-rbind(data,t(data.frame(permn(c("a","b","c","c","c")))));
data<-rbind(data,t(data.frame(permn(c("a","b","b","c","c")))));
data<-rbind(data,t(data.frame(permn(c("a","b","c","d","d")))));
data<-rbind(data,t(data.frame(permn(c("a","b","c","d","e")))));
uniqData <- unique(apply(data,1,paste,collapse=""));
write.table(uniqData,file="tt.txt",row.names=F,col.names=F);
