Codechef: April Long Challenge | Valid Pair | SOCKS | Solution

View on Codechef

Chef has three socks in his drawer. Each sock has one of 1010 possible colors, which are represented by integers between 11 and 1010. Specifically, the colors of the socks are AA, BB, and CC.

Chef has to wear two socks which have the same colour. Help Chef find out if that is possible or not.

Input

The first and only line of the input contains three space-separated integers AA, BB and CC.

Output

Print a single line containing the string "YES" if it is possible for Chef to wear two socks with the same colour or "NO" if it is impossible (without quotes).

You may print each character of each string in uppercase or lowercase (for example, the strings “yEs”, “yes”, “Yes” and “YES” will all be treated as identical).

Constraints

  • 1≤A,B,C≤101≤A,B,C≤10

Subtasks

Subtask #1 (100 points): original constraints

Example Input 1

5 4 3

Example Output 1

NO

Codechef Explanation

Since there are no two socks with the same colour, Chef cannot wear a pair of socks with the same colour.

Example Input 2

5 5 5

Example Output 2

YES
Code

#include <iostream>
#include <string>
#include <bits/stdc++.h>

using namespace std;
#define ll long long int

int main()
{
    int v1, v2, v3;
    cin >> v1 >> v2 >> v3;
    if (v1 == v2 || v1 == v3 || v2 == v3)
    {
        cout << "YES";
    }
    else
    {
        cout << "NO";
    }
    return 0;
}

See more posts here