#include <iostream>
#include <algorithm>

int main() {
	const int n = 4;
	const int m = 3;
	
	std::string path(n - 1, 'B');
	path.resize(n - 1 + m - 1, 'R'); // path is sorted and would be {B, .., B, R, .., R}
	
	int i = 0;
	do {
	     std::cout << i++ << ": "<< path << std::endl; // or any other way t print it
	} while (std::next_permutation(path.begin(), path.end()));
}