import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        String s1 = str.replace(str.substring(0,1),"");
        if(s1.length() !=2) {
            System.out.println("No");
            return;
        }
        String s2 = s1.replace(s1.substring(0,1),"");
        if(s2.length()==0) System.out.println("Yes");
        else System.out.println("No");

    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        String s1 = str.replace(str.substring(0,1),"");
        if(s1.length() !=2) {
            System.out.println("No");
            return;
        }
        String s2 = s1.replace(s1.substring(0,1),"");
        if(s2.length()==0) 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.next();
        String s1 = str.replace(str.substring(0,1),"");
        if(s1.length() !=2) {
            System.out.println("No");
            return;
        }
        String s2 = s1.replace(s1.substring(0,1),"");
        if(s2.length()==0) System.out.println("Yes");
        else System.out.println("No");

    } main {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        String s1 = str.replace(str.substring(0,1),"");
        if(s1.length() !=2) {
            System.out.println("No");
            return;
        }
        String s2 = s1.replace(s1.substring(0,1),"");
        if(s2.length()==0) System.out.println("Yes");
        else System.out.println("No");

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc String s1 = str.replace(str.substring(0,1),""); s1 str.replace(str.substring(0,1),"") str.replace str str.substring(0,1) str.substring str 0 1 "" if(s1.length() !=2) {
            System.out.println("No");
            return;
        } s1.length() !=2 s1.length() s1.length s1 2 {
            System.out.println("No");
            return;
        } System.out.println("No") System.out.println System.out System System.out "No" return; String s2 = s1.replace(s1.substring(0,1),""); s2 s1.replace(s1.substring(0,1),"") s1.replace s1 s1.substring(0,1) s1.substring s1 0 1 "" if(s2.length()==0) System.out.println("Yes");
        else System.out.println("No"); s2.length()==0 s2.length() s2.length s2 0 System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        String s1 = str.replace(str.substring(0,1),"");
        if(s1.length() !=2) {
            System.out.println("No");
            return;
        }
        String s2 = s1.replace(s1.substring(0,1),"");
        if(s2.length()==0) System.out.println("Yes");
        else System.out.println("No");

    }
}