Click Here to go back to the homepage.

Erase Securely Solution:


#include <bits/stdc++.h>

using namespace std;

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

    string line;
    int passes;
    getline(cin, line);
    passes = stoi(line, nullptr);

    getline(cin, line);

    string line2;
    getline(cin, line2);

    bool same = passes % 2 == 0;

    for(int i = 0; i < line.length(); i++){
        if ((same && line[i] != line2[i]) || (!same && line[i] == line2[i]) ){
            cout << "Deletion failed" << endl;
            return 0;
        }
    }
    cout << "Deletion succeeded" << endl;
    return 0;
}