import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] c = S.toCharArray();
        Arrays.sort(c);
        String ans = "";
        if(c[0] == c[1] && c[2] == c[3] && c[0] != c[2])    ans = "Yes";
        else    ans = "No";
        
        System.out.print(ans);
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] c = S.toCharArray();
        Arrays.sort(c);
        String ans = "";
        if(c[0] == c[1] && c[2] == c[3] && c[0] != c[2])    ans = "Yes";
        else    ans = "No";
        
        System.out.print(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] c = S.toCharArray();
        Arrays.sort(c);
        String ans = "";
        if(c[0] == c[1] && c[2] == c[3] && c[0] != c[2])    ans = "Yes";
        else    ans = "No";
        
        System.out.print(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] c = S.toCharArray();
        Arrays.sort(c);
        String ans = "";
        if(c[0] == c[1] && c[2] == c[3] && c[0] != c[2])    ans = "Yes";
        else    ans = "No";
        
        System.out.print(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc char[] c = S.toCharArray(); c S.toCharArray() S.toCharArray S Arrays.sort(c) Arrays.sort Arrays c String ans = ""; ans "" if(c[0] == c[1] && c[2] == c[3] && c[0] != c[2])    ans = "Yes";
        else    ans = "No"; c[0] == c[1] && c[2] == c[3] && c[0] != c[2] c[0] == c[1] && c[2] == c[3] && c[0] != c[2] c[0] == c[1] c[0] c 0 c[1] c 1 c[2] == c[3] c[2] c 2 c[3] c 3 c[0] != c[2] c[0] c 0 c[2] c 2 ans = "Yes" ans "Yes" ans = "No" ans "No" System.out.print(ans) System.out.print System.out System System.out ans String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] c = S.toCharArray();
        Arrays.sort(c);
        String ans = "";
        if(c[0] == c[1] && c[2] == c[3] && c[0] != c[2])    ans = "Yes";
        else    ans = "No";
        
        System.out.print(ans);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] c = S.toCharArray();
        Arrays.sort(c);
        String ans = "";
        if(c[0] == c[1] && c[2] == c[3] && c[0] != c[2])    ans = "Yes";
        else    ans = "No";
        
        System.out.print(ans);
    }
} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] c = S.toCharArray();
        Arrays.sort(c);
        String ans = "";
        if(c[0] == c[1] && c[2] == c[3] && c[0] != c[2])    ans = "Yes";
        else    ans = "No";
        
        System.out.print(ans);
    }
}