import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans[] = { "Yes", "No" };
		int an = 0;
		sc.close();
		char tmp[] = s.toCharArray();
		Arrays.sort(tmp);
		int cnt = 1;
		if(tmp[0] != tmp[1] || tmp[2] != tmp[3])an = 1;
		if(tmp[0] == tmp[2])an = 1;
		System.out.println(ans[an]);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans[] = { "Yes", "No" };
		int an = 0;
		sc.close();
		char tmp[] = s.toCharArray();
		Arrays.sort(tmp);
		int cnt = 1;
		if(tmp[0] != tmp[1] || tmp[2] != tmp[3])an = 1;
		if(tmp[0] == tmp[2])an = 1;
		System.out.println(ans[an]);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans[] = { "Yes", "No" };
		int an = 0;
		sc.close();
		char tmp[] = s.toCharArray();
		Arrays.sort(tmp);
		int cnt = 1;
		if(tmp[0] != tmp[1] || tmp[2] != tmp[3])an = 1;
		if(tmp[0] == tmp[2])an = 1;
		System.out.println(ans[an]);
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans[] = { "Yes", "No" };
		int an = 0;
		sc.close();
		char tmp[] = s.toCharArray();
		Arrays.sort(tmp);
		int cnt = 1;
		if(tmp[0] != tmp[1] || tmp[2] != tmp[3])an = 1;
		if(tmp[0] == tmp[2])an = 1;
		System.out.println(ans[an]);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String ans[] = { "Yes", "No" }; ans { "Yes", "No" } "Yes" "No" int an = 0; an 0 sc.close() sc.close sc char tmp[] = s.toCharArray(); tmp s.toCharArray() s.toCharArray s Arrays.sort(tmp) Arrays.sort Arrays tmp int cnt = 1; cnt 1 if(tmp[0] != tmp[1] || tmp[2] != tmp[3])an = 1; tmp[0] != tmp[1] || tmp[2] != tmp[3] tmp[0] != tmp[1] tmp[0] tmp 0 tmp[1] tmp 1 tmp[2] != tmp[3] tmp[2] tmp 2 tmp[3] tmp 3 an = 1 an 1 if(tmp[0] == tmp[2])an = 1; tmp[0] == tmp[2] tmp[0] tmp 0 tmp[2] tmp 2 an = 1 an 1 System.out.println(ans[an]) System.out.println System.out System System.out ans[an] ans an String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans[] = { "Yes", "No" };
		int an = 0;
		sc.close();
		char tmp[] = s.toCharArray();
		Arrays.sort(tmp);
		int cnt = 1;
		if(tmp[0] != tmp[1] || tmp[2] != tmp[3])an = 1;
		if(tmp[0] == tmp[2])an = 1;
		System.out.println(ans[an]);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans[] = { "Yes", "No" };
		int an = 0;
		sc.close();
		char tmp[] = s.toCharArray();
		Arrays.sort(tmp);
		int cnt = 1;
		if(tmp[0] != tmp[1] || tmp[2] != tmp[3])an = 1;
		if(tmp[0] == tmp[2])an = 1;
		System.out.println(ans[an]);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans[] = { "Yes", "No" };
		int an = 0;
		sc.close();
		char tmp[] = s.toCharArray();
		Arrays.sort(tmp);
		int cnt = 1;
		if(tmp[0] != tmp[1] || tmp[2] != tmp[3])an = 1;
		if(tmp[0] == tmp[2])an = 1;
		System.out.println(ans[an]);
	}
}
