import java.util.*;

class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        String[] sArray = new String[4];
        int count = 0;
        
        for (int i = 0; i < 4; i++) {
            sArray[i] = s.substring(i, i + 1);
        }
        
        Arrays.sort(sArray);
        if (sArray[0].equals(sArray[1])) {
            count++;
        }
        
        if (sArray[2].equals(sArray[3])) {
            count++;
        }
        
        if (!sArray[0].equals(sArray[3]) ) {
            count++;
        }
        
        if (count == 3) {
            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 s = sc.next();
        String[] sArray = new String[4];
        int count = 0;
        
        for (int i = 0; i < 4; i++) {
            sArray[i] = s.substring(i, i + 1);
        }
        
        Arrays.sort(sArray);
        if (sArray[0].equals(sArray[1])) {
            count++;
        }
        
        if (sArray[2].equals(sArray[3])) {
            count++;
        }
        
        if (!sArray[0].equals(sArray[3]) ) {
            count++;
        }
        
        if (count == 3) {
            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();
        String[] sArray = new String[4];
        int count = 0;
        
        for (int i = 0; i < 4; i++) {
            sArray[i] = s.substring(i, i + 1);
        }
        
        Arrays.sort(sArray);
        if (sArray[0].equals(sArray[1])) {
            count++;
        }
        
        if (sArray[2].equals(sArray[3])) {
            count++;
        }
        
        if (!sArray[0].equals(sArray[3]) ) {
            count++;
        }
        
        if (count == 3) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        
    } main {
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        String[] sArray = new String[4];
        int count = 0;
        
        for (int i = 0; i < 4; i++) {
            sArray[i] = s.substring(i, i + 1);
        }
        
        Arrays.sort(sArray);
        if (sArray[0].equals(sArray[1])) {
            count++;
        }
        
        if (sArray[2].equals(sArray[3])) {
            count++;
        }
        
        if (!sArray[0].equals(sArray[3]) ) {
            count++;
        }
        
        if (count == 3) {
            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 String[] sArray = new String[4]; sArray new String[4] 4 int count = 0; count 0 for (int i = 0; i < 4; i++) {
            sArray[i] = s.substring(i, i + 1);
        } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
            sArray[i] = s.substring(i, i + 1);
        } {
            sArray[i] = s.substring(i, i + 1);
        } sArray[i] = s.substring(i, i + 1) sArray[i] sArray i s.substring(i, i + 1) s.substring s i i + 1 i 1 Arrays.sort(sArray) Arrays.sort Arrays sArray if (sArray[0].equals(sArray[1])) {
            count++;
        } sArray[0].equals(sArray[1]) sArray[0].equals sArray[0] sArray 0 sArray[1] sArray 1 {
            count++;
        } count++ count if (sArray[2].equals(sArray[3])) {
            count++;
        } sArray[2].equals(sArray[3]) sArray[2].equals sArray[2] sArray 2 sArray[3] sArray 3 {
            count++;
        } count++ count if (!sArray[0].equals(sArray[3]) ) {
            count++;
        } !sArray[0].equals(sArray[3]) sArray[0].equals(sArray[3]) sArray[0].equals sArray[0] sArray 0 sArray[3] sArray 3 {
            count++;
        } count++ count if (count == 3) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } count == 3 count 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
import java.util.*;

class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        String[] sArray = new String[4];
        int count = 0;
        
        for (int i = 0; i < 4; i++) {
            sArray[i] = s.substring(i, i + 1);
        }
        
        Arrays.sort(sArray);
        if (sArray[0].equals(sArray[1])) {
            count++;
        }
        
        if (sArray[2].equals(sArray[3])) {
            count++;
        }
        
        if (!sArray[0].equals(sArray[3]) ) {
            count++;
        }
        
        if (count == 3) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        
    }
} 