1. Abridged Problem Statement
You are given two 4-digit strings s (secret) and t (guess), each with distinct digits (leading zeros allowed).
Compute:
- Bulls = count of positions i where s[i] == t[i].
- Cows = count of digits that appear in both s and t but at different positions.
Output the two values: "bulls cows".

2. Detailed Editorial
We must compare two length-4 strings of distinct digits and report:
- Bulls: exact matches in both digit and position.
- Cows: digits present in both strings but in different positions.

Constraints are minimal (always size 4, digits distinct), so an O(1) or O(n) solution is trivial. Here's one clear approach:

Step 1: Count Bulls
 Traverse indices i = 0..3. Whenever s[i] == t[i], increment bulls.

Step 2: Record which digits occur in the secret
 Since the secret's digits are distinct, we can mark each digit we see. Use either:
 - A boolean array seen[10], indexed by digit character – '0'→0, …, '9'→9.
 - Or a hash/set of characters.

Step 3: Count total "matches" (bulls + cows)
 Traverse indices i = 0..3 on the guess string t.
 If t[i] is marked as seen in the secret, insert it into a set (cows_and_bulls).
 After this pass, cows_and_bulls.size() counts distinct digits that appear in both strings (at any position), i.e. bulls + cows.

Step 4: Compute cows = cows_and_bulls.size() – bulls.
 Since every bull was also counted in the set, subtract bulls to get cows.

Overall time and memory are constant. No tricky edge cases beyond the inherent distinctness of digits.

3. C++ Solution

```cpp
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

string s1, s2;

void read() { cin >> s1 >> s2; }

void solve() {
    // Bulls are positions where the secret and guess share the same digit.
    // Since all digits within a number are distinct, the digits present in both
    // numbers (in any position) are bulls plus cows, so we collect that set and
    // subtract the bull count to get the number of cows. c1 marks which digits
    // appear in the secret.

    map<char, int> c1;
    set<char> cows_and_bulls;
    int bulls = 0;

    for(int i = 0; i < (int)s1.size(); i++) {
        if(s1[i] == s2[i]) {
            bulls++;
        }

        c1[s1[i]] = 1;
    }

    for(int i = 0; i < (int)s1.size(); i++) {
        if(c1[s2[i]]) {
            cows_and_bulls.insert(s2[i]);
        }
    }

    cout << bulls << " " << cows_and_bulls.size() - bulls << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        solve();
    }

    return 0;
}
```

4. Python Solution

```python
# Read the secret and the guess as strings
secret = input().strip()
guess = input().strip()

# Count bulls: positions where characters match exactly
bulls = sum(1 for i in range(4) if secret[i] == guess[i])

# Create a set of secret digits for quick membership tests
secret_digits = set(secret)

# Count total matches (bulls + cows): digits in guess that appear anywhere in secret
matches = sum(1 for ch in guess if ch in secret_digits)

# Cows are matches that are not bulls
cows = matches - bulls

# Output bulls and cows
print(bulls, cows)
```

5. Compressed Editorial
- Traverse both strings:
  • bulls = count of i with s[i] == t[i].
  • Use a map/array to mark secret's digits.
- Build cows_and_bulls set: all guess digits found in the secret.
- cows = cows_and_bulls.size() – bulls.
Time and space O(1).
