import java.text.ParseException;
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		char[] c = sc.next().toCharArray();
		for (char d : c) {
			int count=0;
			for (char e : c) {
				if(d==e) count++;
			}
			if(count != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
} import java.text.ParseException; ParseException java.text import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws ParseException {

		Scanner sc = new Scanner(System.in);
		char[] c = sc.next().toCharArray();
		for (char d : c) {
			int count=0;
			for (char e : c) {
				if(d==e) count++;
			}
			if(count != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
} Main public static void main(String[] args) throws ParseException {

		Scanner sc = new Scanner(System.in);
		char[] c = sc.next().toCharArray();
		for (char d : c) {
			int count=0;
			for (char e : c) {
				if(d==e) count++;
			}
			if(count != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	} main {

		Scanner sc = new Scanner(System.in);
		char[] c = sc.next().toCharArray();
		for (char d : c) {
			int count=0;
			for (char e : c) {
				if(d==e) count++;
			}
			if(count != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] c = sc.next().toCharArray(); c sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc for (char d : c) {
			int count=0;
			for (char e : c) {
				if(d==e) count++;
			}
			if(count != 2) {
				System.out.println("No");
				return;
			}
		} char d c {
			int count=0;
			for (char e : c) {
				if(d==e) count++;
			}
			if(count != 2) {
				System.out.println("No");
				return;
			}
		} {
			int count=0;
			for (char e : c) {
				if(d==e) count++;
			}
			if(count != 2) {
				System.out.println("No");
				return;
			}
		} int count=0; count 0 for (char e : c) {
				if(d==e) count++;
			} char e c {
				if(d==e) count++;
			} {
				if(d==e) count++;
			} if(d==e) count++; d==e d e count++ count if(count != 2) {
				System.out.println("No");
				return;
			} count != 2 count 2 {
				System.out.println("No");
				return;
			} System.out.println("No") System.out.println System.out System System.out "No" return; System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
	public static void main(String[] args) throws ParseException {

		Scanner sc = new Scanner(System.in);
		char[] c = sc.next().toCharArray();
		for (char d : c) {
			int count=0;
			for (char e : c) {
				if(d==e) count++;
			}
			if(count != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
} public class Main {
	public static void main(String[] args) throws ParseException {

		Scanner sc = new Scanner(System.in);
		char[] c = sc.next().toCharArray();
		for (char d : c) {
			int count=0;
			for (char e : c) {
				if(d==e) count++;
			}
			if(count != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
} Main
import java.text.ParseException;
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		char[] c = sc.next().toCharArray();
		for (char d : c) {
			int count=0;
			for (char e : c) {
				if(d==e) count++;
			}
			if(count != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}
