import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	final int LEN = 100000;

	void doIt() {
		String s = sc.next();
		char c[] = s.toCharArray();
		int cnt[] = new int[1000];
		Arrays.fill(cnt, 0);
		for(int i = 0; i < 4; i++) {
			cnt[c[i]]++;
		}
		for(int i = 0; i < 1000; i++) {
			if(cnt[i] == 0 || cnt[i] == 2) continue;
			System.out.println("No");
			return;
		}
		System.out.println("Yes");
	}
	public static void main(String[] args) {
		new Main().doIt();
	}
} import java.util.*; util.* java public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	final int LEN = 100000;

	void doIt() {
		String s = sc.next();
		char c[] = s.toCharArray();
		int cnt[] = new int[1000];
		Arrays.fill(cnt, 0);
		for(int i = 0; i < 4; i++) {
			cnt[c[i]]++;
		}
		for(int i = 0; i < 1000; i++) {
			if(cnt[i] == 0 || cnt[i] == 2) continue;
			System.out.println("No");
			return;
		}
		System.out.println("Yes");
	}
	public static void main(String[] args) {
		new Main().doIt();
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final int MOD = 1000000007; MOD 1000000007 final int MAX = Integer.MAX_VALUE; MAX Integer.MAX_VALUE Integer Integer.MAX_VALUE final long LMAX = Long.MAX_VALUE; LMAX Long.MAX_VALUE Long Long.MAX_VALUE final int LEN = 100000; LEN 100000 void doIt() {
		String s = sc.next();
		char c[] = s.toCharArray();
		int cnt[] = new int[1000];
		Arrays.fill(cnt, 0);
		for(int i = 0; i < 4; i++) {
			cnt[c[i]]++;
		}
		for(int i = 0; i < 1000; i++) {
			if(cnt[i] == 0 || cnt[i] == 2) continue;
			System.out.println("No");
			return;
		}
		System.out.println("Yes");
	} doIt {
		String s = sc.next();
		char c[] = s.toCharArray();
		int cnt[] = new int[1000];
		Arrays.fill(cnt, 0);
		for(int i = 0; i < 4; i++) {
			cnt[c[i]]++;
		}
		for(int i = 0; i < 1000; i++) {
			if(cnt[i] == 0 || cnt[i] == 2) continue;
			System.out.println("No");
			return;
		}
		System.out.println("Yes");
	} String s = sc.next(); s sc.next() sc.next sc char c[] = s.toCharArray(); c s.toCharArray() s.toCharArray s int cnt[] = new int[1000]; cnt new int[1000] 1000 Arrays.fill(cnt, 0) Arrays.fill Arrays cnt 0 for(int i = 0; i < 4; i++) {
			cnt[c[i]]++;
		} int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
			cnt[c[i]]++;
		} {
			cnt[c[i]]++;
		} cnt[c[i]]++ cnt[c[i]] cnt c[i] c i for(int i = 0; i < 1000; i++) {
			if(cnt[i] == 0 || cnt[i] == 2) continue;
			System.out.println("No");
			return;
		} int i = 0; int i = 0; i 0 i < 1000 i 1000 i++ i++ i {
			if(cnt[i] == 0 || cnt[i] == 2) continue;
			System.out.println("No");
			return;
		} {
			if(cnt[i] == 0 || cnt[i] == 2) continue;
			System.out.println("No");
			return;
		} if(cnt[i] == 0 || cnt[i] == 2) continue; cnt[i] == 0 || cnt[i] == 2 cnt[i] == 0 cnt[i] cnt i 0 cnt[i] == 2 cnt[i] cnt i 2 continue; System.out.println("No") System.out.println System.out System System.out "No" return; System.out.println("Yes") System.out.println System.out System System.out "Yes" public static void main(String[] args) {
		new Main().doIt();
	} main {
		new Main().doIt();
	} new Main().doIt() new Main().doIt new Main() String[] args args public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	final int LEN = 100000;

	void doIt() {
		String s = sc.next();
		char c[] = s.toCharArray();
		int cnt[] = new int[1000];
		Arrays.fill(cnt, 0);
		for(int i = 0; i < 4; i++) {
			cnt[c[i]]++;
		}
		for(int i = 0; i < 1000; i++) {
			if(cnt[i] == 0 || cnt[i] == 2) continue;
			System.out.println("No");
			return;
		}
		System.out.println("Yes");
	}
	public static void main(String[] args) {
		new Main().doIt();
	}
} public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	final int LEN = 100000;

	void doIt() {
		String s = sc.next();
		char c[] = s.toCharArray();
		int cnt[] = new int[1000];
		Arrays.fill(cnt, 0);
		for(int i = 0; i < 4; i++) {
			cnt[c[i]]++;
		}
		for(int i = 0; i < 1000; i++) {
			if(cnt[i] == 0 || cnt[i] == 2) continue;
			System.out.println("No");
			return;
		}
		System.out.println("Yes");
	}
	public static void main(String[] args) {
		new Main().doIt();
	}
} Main
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	final int LEN = 100000;

	void doIt() {
		String s = sc.next();
		char c[] = s.toCharArray();
		int cnt[] = new int[1000];
		Arrays.fill(cnt, 0);
		for(int i = 0; i < 4; i++) {
			cnt[c[i]]++;
		}
		for(int i = 0; i < 1000; i++) {
			if(cnt[i] == 0 || cnt[i] == 2) continue;
			System.out.println("No");
			return;
		}
		System.out.println("Yes");
	}
	public static void main(String[] args) {
		new Main().doIt();
	}
}
