import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	Scanner str = new Scanner(System.in);

	String S  = str.nextLine();
	String x[] = S.split("");

	int m = 0;

	for (int i = 0; i < x.length - 1; i++) {
	    for (int j = i + 1; j < x.length; j++) {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    }
	}

	if (m == 2) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
	Scanner str = new Scanner(System.in);

	String S  = str.nextLine();
	String x[] = S.split("");

	int m = 0;

	for (int i = 0; i < x.length - 1; i++) {
	    for (int j = i + 1; j < x.length; j++) {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    }
	}

	if (m == 2) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
} Main public static void main(String[] args) {
	Scanner str = new Scanner(System.in);

	String S  = str.nextLine();
	String x[] = S.split("");

	int m = 0;

	for (int i = 0; i < x.length - 1; i++) {
	    for (int j = i + 1; j < x.length; j++) {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    }
	}

	if (m == 2) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    } main {
	Scanner str = new Scanner(System.in);

	String S  = str.nextLine();
	String x[] = S.split("");

	int m = 0;

	for (int i = 0; i < x.length - 1; i++) {
	    for (int j = i + 1; j < x.length; j++) {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    }
	}

	if (m == 2) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    } Scanner str = new Scanner(System.in); str new Scanner(System.in) String S  = str.nextLine(); S str.nextLine() str.nextLine str String x[] = S.split(""); x S.split("") S.split S "" int m = 0; m 0 for (int i = 0; i < x.length - 1; i++) {
	    for (int j = i + 1; j < x.length; j++) {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    }
	} int i = 0; int i = 0; i 0 i < x.length - 1 i x.length - 1 x.length x x.length 1 i++ i++ i {
	    for (int j = i + 1; j < x.length; j++) {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    }
	} {
	    for (int j = i + 1; j < x.length; j++) {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    }
	} for (int j = i + 1; j < x.length; j++) {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    } int j = i + 1; int j = i + 1; j i + 1 i 1 j < x.length j x.length x x.length j++ j++ j {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    } {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    } if (x[i].compareTo(x[j]) == 0) {
		    m++;
		} x[i].compareTo(x[j]) == 0 x[i].compareTo(x[j]) x[i].compareTo x[i] x i x[j] x j 0 {
		    m++;
		} m++ m if (m == 2) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	} m == 2 m 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 str = new Scanner(System.in);

	String S  = str.nextLine();
	String x[] = S.split("");

	int m = 0;

	for (int i = 0; i < x.length - 1; i++) {
	    for (int j = i + 1; j < x.length; j++) {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    }
	}

	if (m == 2) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
} public class Main {

    public static void main(String[] args) {
	Scanner str = new Scanner(System.in);

	String S  = str.nextLine();
	String x[] = S.split("");

	int m = 0;

	for (int i = 0; i < x.length - 1; i++) {
	    for (int j = i + 1; j < x.length; j++) {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    }
	}

	if (m == 2) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	Scanner str = new Scanner(System.in);

	String S  = str.nextLine();
	String x[] = S.split("");

	int m = 0;

	for (int i = 0; i < x.length - 1; i++) {
	    for (int j = i + 1; j < x.length; j++) {
		if (x[i].compareTo(x[j]) == 0) {
		    m++;
		}
	    }
	}

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