#include #include #include using namespace std; char text[10000]; int slots[27]; char chars[27]; int char2slot(char ch) { if (ch >= 'a' && ch <= 'z') return ch - 'a' + 1; if (ch == '_') return 0; exit(7); } void solve(const char* in_name, const char* out_name) { int N, A, B, M, D, H, P[27]; ifstream fin(in_name); fin >> N; if (N < 1 || N > 10000) exit(1); string s; fin >> s; fin >> A >> B >> M >> D >> H; if (A < 1 || A > 10000000) exit(2); if (B < 1 || B > 10000000) exit(3); if (M < 1 || M > 10000000) exit(4); if (D < 1 || D > 10000000) exit(5); if (H < 1 || H > 10000000) exit(6); for (int i = 0; i < 27; i++) { fin >> P[i]; //if (P[i] > 1000000) // exit(P[i]); } for (int i = 0; i < 27; i++) { slots[i] = -1; chars[i] = -1; } int slot = 0, c = s.size(); for (int i = 0; i < c; i++) { char ch = s[i]; int sl = char2slot(ch); if (slots[sl] == -1) { chars[slot] = ch; slots[sl] = slot++; } } ofstream fout(out_name); fout << slot << endl; for (int i = 0; i < slot; i++) fout << chars[i] << endl; fout << 2 * c << endl; for (int i = 0; i < c; i++) { char ch = s[i]; int sl = char2slot(ch); fout << "cd " << slots[sl] + 1 << endl; fout << "w 1" << endl; } } int main() { solve("printing.in", "printing.out"); return 0; }