Click Here to go back to the homepage.

Okviri Solution:


#include <bits/stdc++.h>
using namespace std;

int main(){
    // #ifndef TESTING
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    string peter_pan[3] = {
        "..#..", ".#.#.", "#.X.#"
    };
    string wendy[3] = {
        "..*..", ".*.*.", "*.X.*"
    };
    string result[3];
    char c;
    int charCount = 0;
    while(cin >> c){
        wendy[2][2] = c;
        peter_pan[2][2] = c;
        if(charCount){
            for(auto &line:result){
                line.resize(line.size()-1);
            }
        }
        if(++charCount % 3 == 0){
            for(int i = 0; i < 3; i++){
                result[i].append(wendy[i] + " ");
            }
        } else if(charCount > 1 && charCount % 3 == 1){
            for(int i = 0; i < 3; i++){
                result[i].append(peter_pan[i].substr(1));
            }
        }
            else {
            for(int i = 0; i < 3; i++){
                result[i].append(peter_pan[i]);
            }
        }
    }
    cout << result[0] << endl << result[1] << endl << result[2] << endl << result[1] << endl << result[0];
    return 0;
}