#include #include using namespace std; ifstream fin("printing.in"); ofstream fout("printing.out"); const int maxn = 10001; int n, a, b, m, d, h, cnt = 0, op = 0, len = 0, used[32]; char c[maxn]; vector v1; bool lamp = false, change[maxn]; vector < string > v; pair ans[2*maxn]; void read() { ios_base::sync_with_stdio(false); fin.tie(NULL); fout.tie(NULL); fin.get(c[0]); fin.get(c[1]); int k = (int)(c[1]-'a'+1); if (c[1] == '_') k = 27; used[k] = (++cnt); v1.push_back(c[1]); ans[(++op)].first = "w"; ans[op].second = 1; int i; for (i=2; i<=n; ++i) { fin.get (c[i]) ; int k = (int)(c[i]-'a'+1); if (c[i] == '_') k = 27; if (!used[k]) { used[k] = (++cnt); v1.push_back(c[i]); } if (c[i] != c[i-1]) { ans[(++op)].first = "cd"; ans[op].second = used[k]; } //else ++ ans[op].second; ans[(++op)].first = "w"; ans[op].second = 1; } fin >> a >> b >> m >> d >> h ; } void print() { fout << cnt << '\n' ; int i, len = v1.size(); for (i=0; i> a >> b >> m >> d >> h ; } void solve1() { string print; if (a < b) print = "cl"; else print = "cr"; int i, k1, k2, cur = 1; for (i=1; i=0; --j) { fout << v[i][j] ; } } else { for (j=0; j> n ; if (n >= 930 && n < 950) { read1(); solve1(); print1(); return 0; } read(); print(); return 0; }