import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main{
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split("");
			Arrays.sort(chr);

			 System.out.println(chr[0].equals(chr[1])
					 &&chr[2].equals(chr[3])
					 &&!(chr[0].equals(chr[2]))?"Yes":"No");
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util public class Main{
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split("");
			Arrays.sort(chr);

			 System.out.println(chr[0].equals(chr[1])
					 &&chr[2].equals(chr[3])
					 &&!(chr[0].equals(chr[2]))?"Yes":"No");
		}
	}
} Main public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split("");
			Arrays.sort(chr);

			 System.out.println(chr[0].equals(chr[1])
					 &&chr[2].equals(chr[3])
					 &&!(chr[0].equals(chr[2]))?"Yes":"No");
		}
	} main {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split("");
			Arrays.sort(chr);

			 System.out.println(chr[0].equals(chr[1])
					 &&chr[2].equals(chr[3])
					 &&!(chr[0].equals(chr[2]))?"Yes":"No");
		}
	} try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split("");
			Arrays.sort(chr);

			 System.out.println(chr[0].equals(chr[1])
					 &&chr[2].equals(chr[3])
					 &&!(chr[0].equals(chr[2]))?"Yes":"No");
		} {

			String in = br.readLine();
			String chr[] = in.split("");
			Arrays.sort(chr);

			 System.out.println(chr[0].equals(chr[1])
					 &&chr[2].equals(chr[3])
					 &&!(chr[0].equals(chr[2]))?"Yes":"No");
		} BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in)) new BufferedReader(
				new InputStreamReader(System.in)) String in = br.readLine(); in br.readLine() br.readLine br String chr[] = in.split(""); chr in.split("") in.split in "" Arrays.sort(chr) Arrays.sort Arrays chr System.out.println(chr[0].equals(chr[1])
					 &&chr[2].equals(chr[3])
					 &&!(chr[0].equals(chr[2]))?"Yes":"No") System.out.println System.out System System.out chr[0].equals(chr[1])
					 &&chr[2].equals(chr[3])
					 &&!(chr[0].equals(chr[2]))?"Yes":"No" chr[0].equals(chr[1])
					 &&chr[2].equals(chr[3])
					 &&!(chr[0].equals(chr[2])) chr[0].equals(chr[1])
					 &&chr[2].equals(chr[3])
					 &&!(chr[0].equals(chr[2])) chr[0].equals(chr[1]) chr[0].equals chr[0] chr 0 chr[1] chr 1 chr[2].equals(chr[3]) chr[2].equals chr[2] chr 2 chr[3] chr 3 !(chr[0].equals(chr[2])) (chr[0].equals(chr[2])) chr[0].equals chr[0] chr 0 chr[2] chr 2 "Yes" "No" String[] args args public class Main{
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split("");
			Arrays.sort(chr);

			 System.out.println(chr[0].equals(chr[1])
					 &&chr[2].equals(chr[3])
					 &&!(chr[0].equals(chr[2]))?"Yes":"No");
		}
	}
} public class Main{
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split("");
			Arrays.sort(chr);

			 System.out.println(chr[0].equals(chr[1])
					 &&chr[2].equals(chr[3])
					 &&!(chr[0].equals(chr[2]))?"Yes":"No");
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main{
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split("");
			Arrays.sort(chr);

			 System.out.println(chr[0].equals(chr[1])
					 &&chr[2].equals(chr[3])
					 &&!(chr[0].equals(chr[2]))?"Yes":"No");
		}
	}
}