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