import java.util.*;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] a = sc.next().split("");
        long cnt = Stream.of(a).distinct().count();
        if (cnt == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} import java.util.*; util.* java import java.util.stream.Stream; Stream java.util.stream public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] a = sc.next().split("");
        long cnt = Stream.of(a).distinct().count();
        if (cnt == 2) {
            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[] a = sc.next().split("");
        long cnt = Stream.of(a).distinct().count();
        if (cnt == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String[] a = sc.next().split("");
        long cnt = Stream.of(a).distinct().count();
        if (cnt == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] a = sc.next().split(""); a sc.next().split("") sc.next().split sc.next() sc.next sc "" long cnt = Stream.of(a).distinct().count(); cnt Stream.of(a).distinct().count() Stream.of(a).distinct().count Stream.of(a).distinct() Stream.of(a).distinct Stream.of(a) Stream.of Stream a if (cnt == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } cnt == 2 cnt 2 {
            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[] a = sc.next().split("");
        long cnt = Stream.of(a).distinct().count();
        if (cnt == 2) {
            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[] a = sc.next().split("");
        long cnt = Stream.of(a).distinct().count();
        if (cnt == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main
import java.util.*;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] a = sc.next().split("");
        long cnt = Stream.of(a).distinct().count();
        if (cnt == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}
