import java.util.*;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int[] c = new int[26];
        for (int i=0;i<s.length();i++)c[s.charAt(i)-'A']++;
        boolean b = true;
        for (int i=0;i<26;i++)if (c[i]!=0&&c[i]!=2)b=false;
        if (b)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);
        String s = sc.next();
        int[] c = new int[26];
        for (int i=0;i<s.length();i++)c[s.charAt(i)-'A']++;
        boolean b = true;
        for (int i=0;i<26;i++)if (c[i]!=0&&c[i]!=2)b=false;
        if (b)System.out.println("Yes");
        else System.out.println("No");
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int[] c = new int[26];
        for (int i=0;i<s.length();i++)c[s.charAt(i)-'A']++;
        boolean b = true;
        for (int i=0;i<26;i++)if (c[i]!=0&&c[i]!=2)b=false;
        if (b)System.out.println("Yes");
        else System.out.println("No");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int[] c = new int[26];
        for (int i=0;i<s.length();i++)c[s.charAt(i)-'A']++;
        boolean b = true;
        for (int i=0;i<26;i++)if (c[i]!=0&&c[i]!=2)b=false;
        if (b)System.out.println("Yes");
        else System.out.println("No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int[] c = new int[26]; c new int[26] 26 for (int i=0;i<s.length();i++)c[s.charAt(i)-'A']++; int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i c[s.charAt(i)-'A']++; c[s.charAt(i)-'A']++ c[s.charAt(i)-'A'] c s.charAt(i)-'A' s.charAt(i) s.charAt s i 'A' boolean b = true; b true for (int i=0;i<26;i++)if (c[i]!=0&&c[i]!=2)b=false; int i=0; int i=0; i 0 i<26 i 26 i++ i++ i if (c[i]!=0&&c[i]!=2)b=false; if (c[i]!=0&&c[i]!=2)b=false; c[i]!=0&&c[i]!=2 c[i]!=0 c[i] c i 0 c[i]!=2 c[i] c i 2 b=false b false if (b)System.out.println("Yes");
        else System.out.println("No"); b 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 public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int[] c = new int[26];
        for (int i=0;i<s.length();i++)c[s.charAt(i)-'A']++;
        boolean b = true;
        for (int i=0;i<26;i++)if (c[i]!=0&&c[i]!=2)b=false;
        if (b)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 s = sc.next();
        int[] c = new int[26];
        for (int i=0;i<s.length();i++)c[s.charAt(i)-'A']++;
        boolean b = true;
        for (int i=0;i<26;i++)if (c[i]!=0&&c[i]!=2)b=false;
        if (b)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);
        String s = sc.next();
        int[] c = new int[26];
        for (int i=0;i<s.length();i++)c[s.charAt(i)-'A']++;
        boolean b = true;
        for (int i=0;i<26;i++)if (c[i]!=0&&c[i]!=2)b=false;
        if (b)System.out.println("Yes");
        else System.out.println("No");
    }
}
