#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <sstream>
#define INF 0x3f3f3f3f
using namespace std;

typedef long long ll;
const int mod = 1e9 + 7;
const ll maxn = 1000005;
const double pi = acos(-1.0);

char s[10];

int main()
{
    int vis[30];
    memset(vis,0,sizeof(vis));
    for(int i = 0; i < 4; i ++)
    {
        cin >> s[i];
        vis[s[i] - 65] ++;
    }
    int num = 0;
    for(int i = 0; i < 26; i ++)
    {
        if(vis[i] != 0)
            num ++;
    }
    if(num == 2)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    system("pause");
    return 0;
}