import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String moji = sc.next();
        String[] ar = moji.split("");
        Arrays.sort(ar);
        if((ar[0].equals(ar[1]))  && (ar[2].equals(ar[3])) && (ar[0].equals(ar[3]))){
            System.out.println("No");
        }
        else if((ar[0].equals(ar[1])) && (ar[2].equals(ar[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String moji = sc.next();
        String[] ar = moji.split("");
        Arrays.sort(ar);
        if((ar[0].equals(ar[1]))  && (ar[2].equals(ar[3])) && (ar[0].equals(ar[3]))){
            System.out.println("No");
        }
        else if((ar[0].equals(ar[1])) && (ar[2].equals(ar[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String moji = sc.next();
        String[] ar = moji.split("");
        Arrays.sort(ar);
        if((ar[0].equals(ar[1]))  && (ar[2].equals(ar[3])) && (ar[0].equals(ar[3]))){
            System.out.println("No");
        }
        else if((ar[0].equals(ar[1])) && (ar[2].equals(ar[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String moji = sc.next();
        String[] ar = moji.split("");
        Arrays.sort(ar);
        if((ar[0].equals(ar[1]))  && (ar[2].equals(ar[3])) && (ar[0].equals(ar[3]))){
            System.out.println("No");
        }
        else if((ar[0].equals(ar[1])) && (ar[2].equals(ar[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String moji = sc.next(); moji sc.next() sc.next sc String[] ar = moji.split(""); ar moji.split("") moji.split moji "" Arrays.sort(ar) Arrays.sort Arrays ar if((ar[0].equals(ar[1]))  && (ar[2].equals(ar[3])) && (ar[0].equals(ar[3]))){
            System.out.println("No");
        }
        else if((ar[0].equals(ar[1])) && (ar[2].equals(ar[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } (ar[0].equals(ar[1]))  && (ar[2].equals(ar[3])) && (ar[0].equals(ar[3])) (ar[0].equals(ar[1]))  && (ar[2].equals(ar[3])) && (ar[0].equals(ar[3])) (ar[0].equals(ar[1])) ar[0].equals ar[0] ar 0 ar[1] ar 1 (ar[2].equals(ar[3])) ar[2].equals ar[2] ar 2 ar[3] ar 3 (ar[0].equals(ar[3])) ar[0].equals ar[0] ar 0 ar[3] ar 3 {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" if((ar[0].equals(ar[1])) && (ar[2].equals(ar[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } (ar[0].equals(ar[1])) && (ar[2].equals(ar[3])) (ar[0].equals(ar[1])) ar[0].equals ar[0] ar 0 ar[1] ar 1 (ar[2].equals(ar[3])) ar[2].equals ar[2] ar 2 ar[3] ar 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) throws Exception {
        Scanner sc = new Scanner(System.in);
        String moji = sc.next();
        String[] ar = moji.split("");
        Arrays.sort(ar);
        if((ar[0].equals(ar[1]))  && (ar[2].equals(ar[3])) && (ar[0].equals(ar[3]))){
            System.out.println("No");
        }
        else if((ar[0].equals(ar[1])) && (ar[2].equals(ar[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String moji = sc.next();
        String[] ar = moji.split("");
        Arrays.sort(ar);
        if((ar[0].equals(ar[1]))  && (ar[2].equals(ar[3])) && (ar[0].equals(ar[3]))){
            System.out.println("No");
        }
        else if((ar[0].equals(ar[1])) && (ar[2].equals(ar[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String moji = sc.next();
        String[] ar = moji.split("");
        Arrays.sort(ar);
        if((ar[0].equals(ar[1]))  && (ar[2].equals(ar[3])) && (ar[0].equals(ar[3]))){
            System.out.println("No");
        }
        else if((ar[0].equals(ar[1])) && (ar[2].equals(ar[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}
