#include <bits/stdc++.h>
using namespace std;

int main() {
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	int tam = s.size(), cont = 1;
	for(int i = 0; i < tam-1; i++) {
		if(s[i] != s[i + 1]) cont++;
	}
	if(cont == 2) cout << "Yes";
	else cout << "No";
	return 0;
}