#include #include using ll = long long; #define MOD 1000000007 #define Mod 998244353 const int MAX = 1000000005; const long long INF = 1000000000000000005LL; using namespace std; using namespace atcoder; int main() { ios::sync_with_stdio(0);cin.tie(); string S; cin >> S; set se; for (int i = 0; i < 3; i++) se.insert(S[i]); cout << (se.size() == 2 and S[0] == S[1] ? "Yes" : "No") << endl; }