#include <iostream> using namespace std; int main() { int n; string str; cin >> n >> str; int cur = 1, top = 1, bottom = (n <= 4) ? n : 4; for (auto cmd : str) { if (cmd == 'U') { if (n <= 4) { if (cur == top) { ...