#include <bits/stdc++.h>
using namespace std;
int main (){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string s;
cin >> s;
int p = 0, o = 0, ans = 0;
s.erase(s.begin());
for (char &c : s) {
if (c == 'N') {
if (o && o >= 2 * p) {
p = o;
o = 0;
++ans;
c = 'R';
}
++o;
}
else {
p = o;
o = 0;
}
}
cout << ans << "\nN" << s;
return 0;
}