import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.function.Function;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        List<Long> s = stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values()
                            .stream()
                            .collect(Collectors.toList());
        String ans = s.equals(Arrays.asList(2L, 2L)) ? "Yes" : "No";
        System.out.println(ans);
    }

} import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util import java.util.function.Function; Function java.util.function import java.util.stream.Collectors; Collectors java.util.stream public class Main {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        List<Long> s = stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values()
                            .stream()
                            .collect(Collectors.toList());
        String ans = s.equals(Arrays.asList(2L, 2L)) ? "Yes" : "No";
        System.out.println(ans);
    }

} Main public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        List<Long> s = stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values()
                            .stream()
                            .collect(Collectors.toList());
        String ans = s.equals(Arrays.asList(2L, 2L)) ? "Yes" : "No";
        System.out.println(ans);
    } main {
        Scanner stdin = new Scanner(System.in);
        List<Long> s = stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values()
                            .stream()
                            .collect(Collectors.toList());
        String ans = s.equals(Arrays.asList(2L, 2L)) ? "Yes" : "No";
        System.out.println(ans);
    } Scanner stdin = new Scanner(System.in); stdin new Scanner(System.in) List<Long> s = stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values()
                            .stream()
                            .collect(Collectors.toList()); s stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values()
                            .stream()
                            .collect(Collectors.toList()) stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values()
                            .stream()
                            .collect stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values()
                            .stream() stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values()
                            .stream stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values() stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting())) stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect stdin.nextLine()
                            .chars()
                            .boxed() stdin.nextLine()
                            .chars()
                            .boxed stdin.nextLine()
                            .chars() stdin.nextLine()
                            .chars stdin.nextLine() stdin.nextLine stdin Collectors.groupingBy(Function.identity(), Collectors.counting()) Collectors.groupingBy Collectors Function.identity() Function.identity Function Collectors.counting() Collectors.counting Collectors Collectors.toList() Collectors.toList Collectors String ans = s.equals(Arrays.asList(2L, 2L)) ? "Yes" : "No"; ans s.equals(Arrays.asList(2L, 2L)) ? "Yes" : "No" s.equals(Arrays.asList(2L, 2L)) s.equals s Arrays.asList(2L, 2L) Arrays.asList Arrays 2L 2L "Yes" "No" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        List<Long> s = stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values()
                            .stream()
                            .collect(Collectors.toList());
        String ans = s.equals(Arrays.asList(2L, 2L)) ? "Yes" : "No";
        System.out.println(ans);
    }

} public class Main {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        List<Long> s = stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values()
                            .stream()
                            .collect(Collectors.toList());
        String ans = s.equals(Arrays.asList(2L, 2L)) ? "Yes" : "No";
        System.out.println(ans);
    }

} Main
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.function.Function;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        List<Long> s = stdin.nextLine()
                            .chars()
                            .boxed()
                            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
                            .values()
                            .stream()
                            .collect(Collectors.toList());
        String ans = s.equals(Arrays.asList(2L, 2L)) ? "Yes" : "No";
        System.out.println(ans);
    }

}
