import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char c1 = s.charAt(0);
		char c2 = s.charAt(1);
		char c3 = s.charAt(2);
		char c4 = s.charAt(3);
		boolean bool =  false;
		if(c1 == c2)
		{
			if(c3 == c4 && c1 != c3)
				bool = true;
		}
		if(c1 == c3) {
			if(c2 == c4 && c1 != c2)
				bool = true;
		}
		if(c1 == c4) {
			if(c2 == c3 && c1 != c2)
				bool = true;
		}
		System.out.println(bool ? "Yes" : "No");
		}
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char c1 = s.charAt(0);
		char c2 = s.charAt(1);
		char c3 = s.charAt(2);
		char c4 = s.charAt(3);
		boolean bool =  false;
		if(c1 == c2)
		{
			if(c3 == c4 && c1 != c3)
				bool = true;
		}
		if(c1 == c3) {
			if(c2 == c4 && c1 != c2)
				bool = true;
		}
		if(c1 == c4) {
			if(c2 == c3 && c1 != c2)
				bool = true;
		}
		System.out.println(bool ? "Yes" : "No");
		}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char c1 = s.charAt(0);
		char c2 = s.charAt(1);
		char c3 = s.charAt(2);
		char c4 = s.charAt(3);
		boolean bool =  false;
		if(c1 == c2)
		{
			if(c3 == c4 && c1 != c3)
				bool = true;
		}
		if(c1 == c3) {
			if(c2 == c4 && c1 != c2)
				bool = true;
		}
		if(c1 == c4) {
			if(c2 == c3 && c1 != c2)
				bool = true;
		}
		System.out.println(bool ? "Yes" : "No");
		} main {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char c1 = s.charAt(0);
		char c2 = s.charAt(1);
		char c3 = s.charAt(2);
		char c4 = s.charAt(3);
		boolean bool =  false;
		if(c1 == c2)
		{
			if(c3 == c4 && c1 != c3)
				bool = true;
		}
		if(c1 == c3) {
			if(c2 == c4 && c1 != c2)
				bool = true;
		}
		if(c1 == c4) {
			if(c2 == c3 && c1 != c2)
				bool = true;
		}
		System.out.println(bool ? "Yes" : "No");
		} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc char c1 = s.charAt(0); c1 s.charAt(0) s.charAt s 0 char c2 = s.charAt(1); c2 s.charAt(1) s.charAt s 1 char c3 = s.charAt(2); c3 s.charAt(2) s.charAt s 2 char c4 = s.charAt(3); c4 s.charAt(3) s.charAt s 3 boolean bool =  false; bool false if(c1 == c2)
		{
			if(c3 == c4 && c1 != c3)
				bool = true;
		} c1 == c2 c1 c2 {
			if(c3 == c4 && c1 != c3)
				bool = true;
		} if(c3 == c4 && c1 != c3)
				bool = true; c3 == c4 && c1 != c3 c3 == c4 c3 c4 c1 != c3 c1 c3 bool = true bool true if(c1 == c3) {
			if(c2 == c4 && c1 != c2)
				bool = true;
		} c1 == c3 c1 c3 {
			if(c2 == c4 && c1 != c2)
				bool = true;
		} if(c2 == c4 && c1 != c2)
				bool = true; c2 == c4 && c1 != c2 c2 == c4 c2 c4 c1 != c2 c1 c2 bool = true bool true if(c1 == c4) {
			if(c2 == c3 && c1 != c2)
				bool = true;
		} c1 == c4 c1 c4 {
			if(c2 == c3 && c1 != c2)
				bool = true;
		} if(c2 == c3 && c1 != c2)
				bool = true; c2 == c3 && c1 != c2 c2 == c3 c2 c3 c1 != c2 c1 c2 bool = true bool true System.out.println(bool ? "Yes" : "No") System.out.println System.out System System.out bool ? "Yes" : "No" bool "Yes" "No" String[] args args public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char c1 = s.charAt(0);
		char c2 = s.charAt(1);
		char c3 = s.charAt(2);
		char c4 = s.charAt(3);
		boolean bool =  false;
		if(c1 == c2)
		{
			if(c3 == c4 && c1 != c3)
				bool = true;
		}
		if(c1 == c3) {
			if(c2 == c4 && c1 != c2)
				bool = true;
		}
		if(c1 == c4) {
			if(c2 == c3 && c1 != c2)
				bool = true;
		}
		System.out.println(bool ? "Yes" : "No");
		}
} public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char c1 = s.charAt(0);
		char c2 = s.charAt(1);
		char c3 = s.charAt(2);
		char c4 = s.charAt(3);
		boolean bool =  false;
		if(c1 == c2)
		{
			if(c3 == c4 && c1 != c3)
				bool = true;
		}
		if(c1 == c3) {
			if(c2 == c4 && c1 != c2)
				bool = true;
		}
		if(c1 == c4) {
			if(c2 == c3 && c1 != c2)
				bool = true;
		}
		System.out.println(bool ? "Yes" : "No");
		}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char c1 = s.charAt(0);
		char c2 = s.charAt(1);
		char c3 = s.charAt(2);
		char c4 = s.charAt(3);
		boolean bool =  false;
		if(c1 == c2)
		{
			if(c3 == c4 && c1 != c3)
				bool = true;
		}
		if(c1 == c3) {
			if(c2 == c4 && c1 != c2)
				bool = true;
		}
		if(c1 == c4) {
			if(c2 == c3 && c1 != c2)
				bool = true;
		}
		System.out.println(bool ? "Yes" : "No");
		}
}

