#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; bool flg = true; set st; for (int i = 0; i < s.size(); i++) { if (!isalpha(s[i])) flg = false; st.emplace(s[i]); } if (s[0] == s[1] && st.size() == 2) cout << "Yes" << endl; else cout << "No" << endl; return 0; }