#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <functional>

using namespace std;



int main() {


	string str;
	
	cin >> str;

	sort(str.begin(), str.end());

	if (str[0] == str[1] && str[2] == str[3] && str[2] != str[3]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}




	return 0;
}

