import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "No";
		String[] c = s.split("");
		Arrays.sort(c);
		if(c[0].equals(c[1]) && !c[1].equals(c[2]) && c[2].equals(c[3])) result = "Yes";

		// 出力
		System.out.println(result);
		
	}
} import java.util.*; util.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import java.math.BigInteger; BigInteger java.math public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "No";
		String[] c = s.split("");
		Arrays.sort(c);
		if(c[0].equals(c[1]) && !c[1].equals(c[2]) && c[2].equals(c[3])) result = "Yes";

		// 出力
		System.out.println(result);
		
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "No";
		String[] c = s.split("");
		Arrays.sort(c);
		if(c[0].equals(c[1]) && !c[1].equals(c[2]) && c[2].equals(c[3])) result = "Yes";

		// 出力
		System.out.println(result);
		
	} main {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "No";
		String[] c = s.split("");
		Arrays.sort(c);
		if(c[0].equals(c[1]) && !c[1].equals(c[2]) && c[2].equals(c[3])) result = "Yes";

		// 出力
		System.out.println(result);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String result = "No"; result "No" String[] c = s.split(""); c s.split("") s.split s "" Arrays.sort(c) Arrays.sort Arrays c if(c[0].equals(c[1]) && !c[1].equals(c[2]) && c[2].equals(c[3])) result = "Yes"; c[0].equals(c[1]) && !c[1].equals(c[2]) && c[2].equals(c[3]) c[0].equals(c[1]) && !c[1].equals(c[2]) && c[2].equals(c[3]) c[0].equals(c[1]) c[0].equals c[0] c 0 c[1] c 1 !c[1].equals(c[2]) c[1].equals(c[2]) c[1].equals c[1] c 1 c[2] c 2 c[2].equals(c[3]) c[2].equals c[2] c 2 c[3] c 3 result = "Yes" result "Yes" System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "No";
		String[] c = s.split("");
		Arrays.sort(c);
		if(c[0].equals(c[1]) && !c[1].equals(c[2]) && c[2].equals(c[3])) result = "Yes";

		// 出力
		System.out.println(result);
		
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "No";
		String[] c = s.split("");
		Arrays.sort(c);
		if(c[0].equals(c[1]) && !c[1].equals(c[2]) && c[2].equals(c[3])) result = "Yes";

		// 出力
		System.out.println(result);
		
	}
} Main
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "No";
		String[] c = s.split("");
		Arrays.sort(c);
		if(c[0].equals(c[1]) && !c[1].equals(c[2]) && c[2].equals(c[3])) result = "Yes";

		// 出力
		System.out.println(result);
		
	}
}
