#define _USE_MATH_DEFINES
#include<math.h>

//#include<cmath>

#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>



//#include "Ants.h"
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define INF (1e9)
#define LNF (1LL<<60)
//#define int long long
#define PI (acos(-1))
#define loop(n) for(int i =0; i<n;i++) 
typedef pair < ll, ll> P;
/****Union-Ford-Tree***/
//int par[int(0x7ffffff)];//Parent
//int Rank[int(0x7ffffff)];//Deep_of_the_Tree

//int a[100] = { 4,2,3,1,5 }, m[100] ={3,2,2};
//int n = 0;
//const ll mod = 1000000007;

/*//n要素で初期化
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		Rank[i] = 0;
	}
}
//木の根探し
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}
//xとyの属する集合を併合
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;

	if (Rank[x] < Rank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}

/************************************************************************************
//*無向グラフのBELL_MAN_FORD;*//*
struct edge { int from, to, cost; };
edge es[10000];
int d[10000];
void shortest_path(int s) {
	for (int i = 0; i < V; i++)d[i] = INF;
	d[s] = 0;
	while (true) {
		bool update = false;
		for (int i = 0; i < E*2; i++) {
			edge e = es[i];
			if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				update = true;
			}
		}
		if (!update)break;
	}

}
int main() {
	cin >> V >> E;
	for (int i = 0; i < E*2; i = i+2) {
		edge e;
		cin >> e.from >> e.to >> e.cost;
		es[i] = e;
		swap(e.to, e.from);
		es[i + 1] = e;

	}
	shortest_path(0);
	cout << d[6] << endl;
}
*////////////////////////////////////////*
int gcd(int a, int b) {//最大公約数を求める
	if (b == 0) return a;
	return gcd(b, a % b);
}
/*****************************************************************************/
//int dx[8] = { 1,1,1,0,0,-1,-1,-1 }, dy[8] = { 1,0,-1,1,-1,1,0,-1};
//vector<int> G[10000];


//struct edge { int to, cost; };
//vector<edge>G[100000];


/**************/


/****
//priority_queue<int> //大きいものから順番に出てくる
//priority_queue<int,vector<int>,greater<int>>//小さいものから出てくる（順位キュー）
.top();
.pop();
.empty();
**/
//void solve();
//int V, E;
//void shortest_path(int);

typedef long double ld;
typedef unsigned long long ull;
const int MX = 3007;
const int  MAX_N = 1 << 17;

//int n, dat[2 * MAX_N - 1];
/*void rmq_init(int n_) {
	n = 1;
	while (n < n_)n *= 2;
	for (int i = 0; i < 2 * n - 1; i++)dat[i] = INT_MAX;

}

void update(int k, int a) {
	k += n - 1;
	dat[k] = a;
	while (k > 0) {
		k = (k - 1) / 2;
		dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
	}
}

int query(int a, int b, int k, int l, int r) {

	if (r <= a || b <= l)return INT_MAX;

	if (a <= l && r <= b)return dat[k];
	else {

		int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
}*/

ll N = 4e5 + 5, M, K;
//int k[10000000];
const ll MOD = ll(1e9) + 7;
/*****************combination*****************************/

/*int fact[1000000], invfact[100000];

ll pow(ll a, ll b, ll m)
{
	ll ans = 1;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int modinv(ll k)
{
	return pow(k, MOD - 2, MOD);
}

void precompute()//最初に実行
{
	fact[0] = fact[1] = 1;
	for (ll i = 2; i < N; i++)
	{
		fact[i] = fact[i - 1] * i;
		fact[i] %= MOD;
	}
	invfact[N - 1] = modinv(fact[N - 1]);
	for (ll i = N - 2; i >= 0; i--)
	{
		invfact[i] = invfact[i + 1] * (i + 1);
		invfact[i] %= MOD;
	}
}

int nCr(ll x, ll y)
{
	if (y > x)
		return 0;
	ll num = fact[x];
	num *= invfact[y];
	num %= MOD;
	num *= invfact[x - y];
	num %= MOD;
	return num;
}*/
/***************************************************************************/
string x; char a, b;
int main() {
	cin >> x;
	a = x[0];
	for (int i = 1; i <= 3; i++) {
		if (a != x[i] && b == 0) {
			b = x[i];
		}
		else if (a != x[i] && b != x[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	if (b == 0) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;


}

Measured memory_bytes: 256