View Code of Problem 4062

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(void)
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int a;
        string str1, str2;
        cin >> str1;
        cin >> str2;
        cin >> a;
        int cnt = 0;
        for (int j = 0; j < str1.size();j++){
            if(str1[j] != str2[j])
                cnt++;
        }
        if(cnt %2 == 1 || cnt /2 > a)
            cout << "NO" << endl;
        else
            cout << "YES" << endl;
    }
}

Double click to view unformatted code.


Back to problem 4062