import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] charArray = sc.next().toCharArray();

        char one =charArray[0];
        int oneCount = 1;
        int twoCount = 0;
        int[] secondCharIndexone = new int[3];
        int index = 0;

        for (int i=1; i<4; i++){
            if (charArray[i] == one){
                oneCount++;
            }else {
                secondCharIndexone[index] = i;
                index++;
            }
        }

        if (oneCount ==2 && charArray[secondCharIndexone[0]] == charArray[secondCharIndexone[1]]){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] charArray = sc.next().toCharArray();

        char one =charArray[0];
        int oneCount = 1;
        int twoCount = 0;
        int[] secondCharIndexone = new int[3];
        int index = 0;

        for (int i=1; i<4; i++){
            if (charArray[i] == one){
                oneCount++;
            }else {
                secondCharIndexone[index] = i;
                index++;
            }
        }

        if (oneCount ==2 && charArray[secondCharIndexone[0]] == charArray[secondCharIndexone[1]]){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] charArray = sc.next().toCharArray();

        char one =charArray[0];
        int oneCount = 1;
        int twoCount = 0;
        int[] secondCharIndexone = new int[3];
        int index = 0;

        for (int i=1; i<4; i++){
            if (charArray[i] == one){
                oneCount++;
            }else {
                secondCharIndexone[index] = i;
                index++;
            }
        }

        if (oneCount ==2 && charArray[secondCharIndexone[0]] == charArray[secondCharIndexone[1]]){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        char[] charArray = sc.next().toCharArray();

        char one =charArray[0];
        int oneCount = 1;
        int twoCount = 0;
        int[] secondCharIndexone = new int[3];
        int index = 0;

        for (int i=1; i<4; i++){
            if (charArray[i] == one){
                oneCount++;
            }else {
                secondCharIndexone[index] = i;
                index++;
            }
        }

        if (oneCount ==2 && charArray[secondCharIndexone[0]] == charArray[secondCharIndexone[1]]){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] charArray = sc.next().toCharArray(); charArray sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc char one =charArray[0]; one charArray[0] charArray 0 int oneCount = 1; oneCount 1 int twoCount = 0; twoCount 0 int[] secondCharIndexone = new int[3]; secondCharIndexone new int[3] 3 int index = 0; index 0 for (int i=1; i<4; i++){
            if (charArray[i] == one){
                oneCount++;
            }else {
                secondCharIndexone[index] = i;
                index++;
            }
        } int i=1; int i=1; i 1 i<4 i 4 i++ i++ i {
            if (charArray[i] == one){
                oneCount++;
            }else {
                secondCharIndexone[index] = i;
                index++;
            }
        } {
            if (charArray[i] == one){
                oneCount++;
            }else {
                secondCharIndexone[index] = i;
                index++;
            }
        } if (charArray[i] == one){
                oneCount++;
            }else {
                secondCharIndexone[index] = i;
                index++;
            } charArray[i] == one charArray[i] charArray i one {
                oneCount++;
            } oneCount++ oneCount {
                secondCharIndexone[index] = i;
                index++;
            } secondCharIndexone[index] = i secondCharIndexone[index] secondCharIndexone index i index++ index if (oneCount ==2 && charArray[secondCharIndexone[0]] == charArray[secondCharIndexone[1]]){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        } oneCount ==2 && charArray[secondCharIndexone[0]] == charArray[secondCharIndexone[1]] oneCount ==2 oneCount 2 charArray[secondCharIndexone[0]] == charArray[secondCharIndexone[1]] charArray[secondCharIndexone[0]] charArray secondCharIndexone[0] secondCharIndexone 0 charArray[secondCharIndexone[1]] charArray secondCharIndexone[1] secondCharIndexone 1 {
            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 sc = new Scanner(System.in);
        char[] charArray = sc.next().toCharArray();

        char one =charArray[0];
        int oneCount = 1;
        int twoCount = 0;
        int[] secondCharIndexone = new int[3];
        int index = 0;

        for (int i=1; i<4; i++){
            if (charArray[i] == one){
                oneCount++;
            }else {
                secondCharIndexone[index] = i;
                index++;
            }
        }

        if (oneCount ==2 && charArray[secondCharIndexone[0]] == charArray[secondCharIndexone[1]]){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] charArray = sc.next().toCharArray();

        char one =charArray[0];
        int oneCount = 1;
        int twoCount = 0;
        int[] secondCharIndexone = new int[3];
        int index = 0;

        for (int i=1; i<4; i++){
            if (charArray[i] == one){
                oneCount++;
            }else {
                secondCharIndexone[index] = i;
                index++;
            }
        }

        if (oneCount ==2 && charArray[secondCharIndexone[0]] == charArray[secondCharIndexone[1]]){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] charArray = sc.next().toCharArray();

        char one =charArray[0];
        int oneCount = 1;
        int twoCount = 0;
        int[] secondCharIndexone = new int[3];
        int index = 0;

        for (int i=1; i<4; i++){
            if (charArray[i] == one){
                oneCount++;
            }else {
                secondCharIndexone[index] = i;
                index++;
            }
        }

        if (oneCount ==2 && charArray[secondCharIndexone[0]] == charArray[secondCharIndexone[1]]){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
}