import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;

public class Main {

    public static void main(String[] args) {
        List<Integer> l = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        for (int i = 0; i < s.length(); i++) {
            int x = s.charAt(i);
            l.add(x);
        }
        Collections.sort(l);
        if (l.get(0) == l.get(1) && l.get(2) == l.get(3) && l.get(0) != l.get(3)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
} import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util public class Main {

    public static void main(String[] args) {
        List<Integer> l = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        for (int i = 0; i < s.length(); i++) {
            int x = s.charAt(i);
            l.add(x);
        }
        Collections.sort(l);
        if (l.get(0) == l.get(1) && l.get(2) == l.get(3) && l.get(0) != l.get(3)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        List<Integer> l = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        for (int i = 0; i < s.length(); i++) {
            int x = s.charAt(i);
            l.add(x);
        }
        Collections.sort(l);
        if (l.get(0) == l.get(1) && l.get(2) == l.get(3) && l.get(0) != l.get(3)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    } main {
        List<Integer> l = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        for (int i = 0; i < s.length(); i++) {
            int x = s.charAt(i);
            l.add(x);
        }
        Collections.sort(l);
        if (l.get(0) == l.get(1) && l.get(2) == l.get(3) && l.get(0) != l.get(3)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    } List<Integer> l = new ArrayList<>(); l new ArrayList<>() Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc for (int i = 0; i < s.length(); i++) {
            int x = s.charAt(i);
            l.add(x);
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            int x = s.charAt(i);
            l.add(x);
        } {
            int x = s.charAt(i);
            l.add(x);
        } int x = s.charAt(i); x s.charAt(i) s.charAt s i l.add(x) l.add l x Collections.sort(l) Collections.sort Collections l if (l.get(0) == l.get(1) && l.get(2) == l.get(3) && l.get(0) != l.get(3)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        } l.get(0) == l.get(1) && l.get(2) == l.get(3) && l.get(0) != l.get(3) l.get(0) == l.get(1) && l.get(2) == l.get(3) && l.get(0) != l.get(3) l.get(0) == l.get(1) l.get(0) l.get l 0 l.get(1) l.get l 1 l.get(2) == l.get(3) l.get(2) l.get l 2 l.get(3) l.get l 3 l.get(0) != l.get(3) l.get(0) l.get l 0 l.get(3) l.get l 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) {
        List<Integer> l = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        for (int i = 0; i < s.length(); i++) {
            int x = s.charAt(i);
            l.add(x);
        }
        Collections.sort(l);
        if (l.get(0) == l.get(1) && l.get(2) == l.get(3) && l.get(0) != l.get(3)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
} public class Main {

    public static void main(String[] args) {
        List<Integer> l = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        for (int i = 0; i < s.length(); i++) {
            int x = s.charAt(i);
            l.add(x);
        }
        Collections.sort(l);
        if (l.get(0) == l.get(1) && l.get(2) == l.get(3) && l.get(0) != l.get(3)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
} Main
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;

public class Main {

    public static void main(String[] args) {
        List<Integer> l = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        for (int i = 0; i < s.length(); i++) {
            int x = s.charAt(i);
            l.add(x);
        }
        Collections.sort(l);
        if (l.get(0) == l.get(1) && l.get(2) == l.get(3) && l.get(0) != l.get(3)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
}
