2020-04-01 23:13:10 +00:00
|
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
const int MAXLEN = 64;
|
|
|
|
|
|
|
|
void flush(char last, int count) {
|
2020-04-02 16:12:39 +00:00
|
|
|
char tile, color;
|
2020-04-01 23:13:10 +00:00
|
|
|
switch(last) {
|
|
|
|
case 'x':
|
2020-04-06 20:53:28 +00:00
|
|
|
tile = (char)0x63; break;
|
2020-04-02 14:17:48 +00:00
|
|
|
case 'f':
|
2020-04-06 20:53:28 +00:00
|
|
|
tile = (char)0x62; break;
|
2020-04-01 23:13:10 +00:00
|
|
|
default:
|
2020-04-06 20:53:28 +00:00
|
|
|
tile = (char)0x60; break;
|
2020-04-01 23:13:10 +00:00
|
|
|
}
|
2020-04-06 20:53:28 +00:00
|
|
|
cout << tile << (char)count;
|
2020-04-01 23:13:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
char line[MAXLEN];
|
|
|
|
char c;
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
cin.getline(line, MAXLEN);
|
|
|
|
if (line[0] == 'Z') break;
|
2020-04-08 07:15:25 +00:00
|
|
|
cout << line << '\0'; /* the title */
|
2020-04-01 23:13:10 +00:00
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
char last = '\0';
|
|
|
|
char current = '\0';
|
|
|
|
|
2020-04-02 14:17:48 +00:00
|
|
|
while(true) {
|
2020-04-01 23:13:10 +00:00
|
|
|
|
|
|
|
cin.getline(line, MAXLEN);
|
|
|
|
if (line[0] == 'z') {
|
|
|
|
flush(current, count);
|
2020-04-06 20:53:28 +00:00
|
|
|
cout << '\0' << '\0';
|
2020-04-01 23:13:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int j = 0; j < 40; ++j) {
|
|
|
|
current = line[j];
|
|
|
|
if (last == 0) last = current;
|
|
|
|
if (current != last || count == 255) {
|
|
|
|
flush(last, count);
|
|
|
|
last = current;
|
|
|
|
count = 1;
|
|
|
|
} else {
|
|
|
|
++count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-08 09:36:18 +00:00
|
|
|
cout << '\0';
|
2020-04-01 23:13:10 +00:00
|
|
|
}
|
2020-04-02 14:17:48 +00:00
|
|
|
|