import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Set set = new HashSet<>();
		char s[] = sc.next().toCharArray();
		for (int i=0; i<s.length; i++) {
			set.add(s[i]);
		}

		System.out.println(set.size()==2 ? "Yes" : "No");

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

	}
} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Set set = new HashSet<>();
		char s[] = sc.next().toCharArray();
		for (int i=0; i<s.length; i++) {
			set.add(s[i]);
		}

		System.out.println(set.size()==2 ? "Yes" : "No");

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

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Set set = new HashSet<>();
		char s[] = sc.next().toCharArray();
		for (int i=0; i<s.length; i++) {
			set.add(s[i]);
		}

		System.out.println(set.size()==2 ? "Yes" : "No");

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

	} main {
		Scanner sc = new Scanner(System.in);
		Set set = new HashSet<>();
		char s[] = sc.next().toCharArray();
		for (int i=0; i<s.length; i++) {
			set.add(s[i]);
		}

		System.out.println(set.size()==2 ? "Yes" : "No");

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

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Set set = new HashSet<>(); set new HashSet<>() char s[] = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc for (int i=0; i<s.length; i++) {
			set.add(s[i]);
		} int i=0; int i=0; i 0 i<s.length i s.length s s.length i++ i++ i {
			set.add(s[i]);
		} {
			set.add(s[i]);
		} set.add(s[i]) set.add set s[i] s i System.out.println(set.size()==2 ? "Yes" : "No") System.out.println System.out System System.out set.size()==2 ? "Yes" : "No" set.size()==2 set.size() set.size set 2 "Yes" "No" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Set set = new HashSet<>();
		char s[] = sc.next().toCharArray();
		for (int i=0; i<s.length; i++) {
			set.add(s[i]);
		}

		System.out.println(set.size()==2 ? "Yes" : "No");

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

	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Set set = new HashSet<>();
		char s[] = sc.next().toCharArray();
		for (int i=0; i<s.length; i++) {
			set.add(s[i]);
		}

		System.out.println(set.size()==2 ? "Yes" : "No");

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

	}
} Main
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Set set = new HashSet<>();
		char s[] = sc.next().toCharArray();
		for (int i=0; i<s.length; i++) {
			set.add(s[i]);
		}

		System.out.println(set.size()==2 ? "Yes" : "No");

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

	}
}