#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include <iomanip>
#include<sstream>
#include<string.h>
using namespace std;
int main()
{
    string s;
    bool a;
    while (cin >> s)
    {
        a = 0;
        if (s[0] == s[1] && s[2] == s[3])
            a = 1;
        if (s[0] == s[2] && s[1] == s[3])
            a = 1;
        if (s[0] == s[3] && s[1] == s[2])
            a = 1;
        if (a == 1)
            cout << "Yes" << '\n';
        else cout << "No" << '\n';
    }
}