import java.util.Scanner;
import java.util.stream.Stream;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str  = sc.nextLine();
        String[] astr = str.split(""); //状況に合わせて
        sc.close();

        Arrays.sort(astr);

        if(astr[0].equals(astr[1]) && !astr[1].equals(astr[2]) && astr[2].equals(astr[3])){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} import java.util.Scanner; Scanner java.util import java.util.stream.Stream; Stream java.util.stream import java.util.Arrays; Arrays java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str  = sc.nextLine();
        String[] astr = str.split(""); //状況に合わせて
        sc.close();

        Arrays.sort(astr);

        if(astr[0].equals(astr[1]) && !astr[1].equals(astr[2]) && astr[2].equals(astr[3])){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str  = sc.nextLine();
        String[] astr = str.split(""); //状況に合わせて
        sc.close();

        Arrays.sort(astr);

        if(astr[0].equals(astr[1]) && !astr[1].equals(astr[2]) && astr[2].equals(astr[3])){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String str  = sc.nextLine();
        String[] astr = str.split(""); //状況に合わせて
        sc.close();

        Arrays.sort(astr);

        if(astr[0].equals(astr[1]) && !astr[1].equals(astr[2]) && astr[2].equals(astr[3])){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str  = sc.nextLine(); str sc.nextLine() sc.nextLine sc String[] astr = str.split(""); astr str.split("") str.split str "" sc.close() sc.close sc Arrays.sort(astr) Arrays.sort Arrays astr if(astr[0].equals(astr[1]) && !astr[1].equals(astr[2]) && astr[2].equals(astr[3])){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } astr[0].equals(astr[1]) && !astr[1].equals(astr[2]) && astr[2].equals(astr[3]) astr[0].equals(astr[1]) && !astr[1].equals(astr[2]) && astr[2].equals(astr[3]) astr[0].equals(astr[1]) astr[0].equals astr[0] astr 0 astr[1] astr 1 !astr[1].equals(astr[2]) astr[1].equals(astr[2]) astr[1].equals astr[1] astr 1 astr[2] astr 2 astr[2].equals(astr[3]) astr[2].equals astr[2] astr 2 astr[3] astr 3 {
            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);
        String str  = sc.nextLine();
        String[] astr = str.split(""); //状況に合わせて
        sc.close();

        Arrays.sort(astr);

        if(astr[0].equals(astr[1]) && !astr[1].equals(astr[2]) && astr[2].equals(astr[3])){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str  = sc.nextLine();
        String[] astr = str.split(""); //状況に合わせて
        sc.close();

        Arrays.sort(astr);

        if(astr[0].equals(astr[1]) && !astr[1].equals(astr[2]) && astr[2].equals(astr[3])){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main
import java.util.Scanner;
import java.util.stream.Stream;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str  = sc.nextLine();
        String[] astr = str.split(""); //状況に合わせて
        sc.close();

        Arrays.sort(astr);

        if(astr[0].equals(astr[1]) && !astr[1].equals(astr[2]) && astr[2].equals(astr[3])){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}