import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		List<Character> list = new ArrayList<Character>();
		list.add(input.charAt(0));
		for (int i = 1; i < input.length(); i++) {
			if (!list.contains(input.charAt(i))) {
				list.add(input.charAt(i));
			}
		}

		if (list.size() == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		List<Character> list = new ArrayList<Character>();
		list.add(input.charAt(0));
		for (int i = 1; i < input.length(); i++) {
			if (!list.contains(input.charAt(i))) {
				list.add(input.charAt(i));
			}
		}

		if (list.size() == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

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

		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		List<Character> list = new ArrayList<Character>();
		list.add(input.charAt(0));
		for (int i = 1; i < input.length(); i++) {
			if (!list.contains(input.charAt(i))) {
				list.add(input.charAt(i));
			}
		}

		if (list.size() == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {

		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		List<Character> list = new ArrayList<Character>();
		list.add(input.charAt(0));
		for (int i = 1; i < input.length(); i++) {
			if (!list.contains(input.charAt(i))) {
				list.add(input.charAt(i));
			}
		}

		if (list.size() == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String input = scan.nextLine(); input scan.nextLine() scan.nextLine scan scan.close() scan.close scan List<Character> list = new ArrayList<Character>(); list new ArrayList<Character>() list.add(input.charAt(0)) list.add list input.charAt(0) input.charAt input 0 for (int i = 1; i < input.length(); i++) {
			if (!list.contains(input.charAt(i))) {
				list.add(input.charAt(i));
			}
		} int i = 1; int i = 1; i 1 i < input.length() i input.length() input.length input i++ i++ i {
			if (!list.contains(input.charAt(i))) {
				list.add(input.charAt(i));
			}
		} {
			if (!list.contains(input.charAt(i))) {
				list.add(input.charAt(i));
			}
		} if (!list.contains(input.charAt(i))) {
				list.add(input.charAt(i));
			} !list.contains(input.charAt(i)) list.contains(input.charAt(i)) list.contains list input.charAt(i) input.charAt input i {
				list.add(input.charAt(i));
			} list.add(input.charAt(i)) list.add list input.charAt(i) input.charAt input i if (list.size() == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} list.size() == 2 list.size() list.size list 2 {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		List<Character> list = new ArrayList<Character>();
		list.add(input.charAt(0));
		for (int i = 1; i < input.length(); i++) {
			if (!list.contains(input.charAt(i))) {
				list.add(input.charAt(i));
			}
		}

		if (list.size() == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		List<Character> list = new ArrayList<Character>();
		list.add(input.charAt(0));
		for (int i = 1; i < input.length(); i++) {
			if (!list.contains(input.charAt(i))) {
				list.add(input.charAt(i));
			}
		}

		if (list.size() == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		List<Character> list = new ArrayList<Character>();
		list.add(input.charAt(0));
		for (int i = 1; i < input.length(); i++) {
			if (!list.contains(input.charAt(i))) {
				list.add(input.charAt(i));
			}
		}

		if (list.size() == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}