import java.util.*;

public class Main {
	public static void main(String[] args) {
		char[] s = new Scanner(System.in).next().toCharArray();
		Arrays.sort(s);
		System.out.println(s[0] == s[1] && s[2] == s[3] && s[1] != s[2] ? "Yes" : "No");
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		char[] s = new Scanner(System.in).next().toCharArray();
		Arrays.sort(s);
		System.out.println(s[0] == s[1] && s[2] == s[3] && s[1] != s[2] ? "Yes" : "No");
	}
} Main public static void main(String[] args) {
		char[] s = new Scanner(System.in).next().toCharArray();
		Arrays.sort(s);
		System.out.println(s[0] == s[1] && s[2] == s[3] && s[1] != s[2] ? "Yes" : "No");
	} main {
		char[] s = new Scanner(System.in).next().toCharArray();
		Arrays.sort(s);
		System.out.println(s[0] == s[1] && s[2] == s[3] && s[1] != s[2] ? "Yes" : "No");
	} char[] s = new Scanner(System.in).next().toCharArray(); s new Scanner(System.in).next().toCharArray() new Scanner(System.in).next().toCharArray new Scanner(System.in).next() new Scanner(System.in).next new Scanner(System.in) Arrays.sort(s) Arrays.sort Arrays s System.out.println(s[0] == s[1] && s[2] == s[3] && s[1] != s[2] ? "Yes" : "No") System.out.println System.out System System.out s[0] == s[1] && s[2] == s[3] && s[1] != s[2] ? "Yes" : "No" s[0] == s[1] && s[2] == s[3] && s[1] != s[2] s[0] == s[1] && s[2] == s[3] && s[1] != s[2] s[0] == s[1] s[0] s 0 s[1] s 1 s[2] == s[3] s[2] s 2 s[3] s 3 s[1] != s[2] s[1] s 1 s[2] s 2 "Yes" "No" String[] args args public class Main {
	public static void main(String[] args) {
		char[] s = new Scanner(System.in).next().toCharArray();
		Arrays.sort(s);
		System.out.println(s[0] == s[1] && s[2] == s[3] && s[1] != s[2] ? "Yes" : "No");
	}
} public class Main {
	public static void main(String[] args) {
		char[] s = new Scanner(System.in).next().toCharArray();
		Arrays.sort(s);
		System.out.println(s[0] == s[1] && s[2] == s[3] && s[1] != s[2] ? "Yes" : "No");
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		char[] s = new Scanner(System.in).next().toCharArray();
		Arrays.sort(s);
		System.out.println(s[0] == s[1] && s[2] == s[3] && s[1] != s[2] ? "Yes" : "No");
	}
}
