#include using namespace std; typedef long long ll; #define vll vector int main() { ll R, K; cin >> R >> K; string f; cin >> f; vll key(8); for(ll i = 0; i < 8; i++){ key[7 - i] = (R & (1 << i)); } unordered_map S; S[111] = 0; S[110] = 1; S[101] = 2; S[100] = 3; S[11] = 4; S[10] = 5; S[1] = 6; S[0] = 7; for(ll nope = 0; nope < K; nope++){ string temp; for(ll i = 0; i < f.size(); i++){ ll a, b, c; if(i == 0){ a = 0; } else { a = (f[i - 1] == 'X') ? 1 : 0; } b = (f[i] == 'X') ? 1 : 0; if(i == f.size() - 1){ c = 0; } else { c = (f[i + 1] == 'X') ? 1 : 0; } ll hash = 100 * a + 10 * b + c; temp += (key[S[hash]] == 0) ? '.' : 'X'; } cout << temp << endl; f = temp; } return 0; }