import java.io.PrintWriter;
import java.util.*;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);

    public static void main(String[] args){
        String str = sc.next();

        Set<String> set = new HashSet<>();
        set.addAll(Arrays.asList(str.split("")));

        println(set.size() == 2 ? "Yes" : "No");
    }

    static int nextInt(){
        return Integer.parseInt(sc.next());
    }
    static Long nextLong(){
        return Long.parseLong(sc.next());
    }
    static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
} import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);

    public static void main(String[] args){
        String str = sc.next();

        Set<String> set = new HashSet<>();
        set.addAll(Arrays.asList(str.split("")));

        println(set.size() == 2 ? "Yes" : "No");
    }

    static int nextInt(){
        return Integer.parseInt(sc.next());
    }
    static Long nextLong(){
        return Long.parseLong(sc.next());
    }
    static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
} Main static String br = System.getProperty("line.separator"); br System.getProperty("line.separator") System.getProperty System "line.separator" static Scanner sc  = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args){
        String str = sc.next();

        Set<String> set = new HashSet<>();
        set.addAll(Arrays.asList(str.split("")));

        println(set.size() == 2 ? "Yes" : "No");
    } main {
        String str = sc.next();

        Set<String> set = new HashSet<>();
        set.addAll(Arrays.asList(str.split("")));

        println(set.size() == 2 ? "Yes" : "No");
    } String str = sc.next(); str sc.next() sc.next sc Set<String> set = new HashSet<>(); set new HashSet<>() set.addAll(Arrays.asList(str.split(""))) set.addAll set Arrays.asList(str.split("")) Arrays.asList Arrays str.split("") str.split str "" println(set.size() == 2 ? "Yes" : "No") println set.size() == 2 ? "Yes" : "No" set.size() == 2 set.size() set.size set 2 "Yes" "No" String[] args args static int nextInt(){
        return Integer.parseInt(sc.next());
    } nextInt {
        return Integer.parseInt(sc.next());
    } return Integer.parseInt(sc.next()); Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc static Long nextLong(){
        return Long.parseLong(sc.next());
    } nextLong {
        return Long.parseLong(sc.next());
    } return Long.parseLong(sc.next()); Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    } println {
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    } PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) out.println(o) out.println out o out.flush() out.flush out Object o o static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    } print {
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    } PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) out.print(o) out.print out o out.flush() out.flush out Object o o public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);

    public static void main(String[] args){
        String str = sc.next();

        Set<String> set = new HashSet<>();
        set.addAll(Arrays.asList(str.split("")));

        println(set.size() == 2 ? "Yes" : "No");
    }

    static int nextInt(){
        return Integer.parseInt(sc.next());
    }
    static Long nextLong(){
        return Long.parseLong(sc.next());
    }
    static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
} public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);

    public static void main(String[] args){
        String str = sc.next();

        Set<String> set = new HashSet<>();
        set.addAll(Arrays.asList(str.split("")));

        println(set.size() == 2 ? "Yes" : "No");
    }

    static int nextInt(){
        return Integer.parseInt(sc.next());
    }
    static Long nextLong(){
        return Long.parseLong(sc.next());
    }
    static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
} Main
import java.io.PrintWriter;
import java.util.*;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);

    public static void main(String[] args){
        String str = sc.next();

        Set<String> set = new HashSet<>();
        set.addAll(Arrays.asList(str.split("")));

        println(set.size() == 2 ? "Yes" : "No");
    }

    static int nextInt(){
        return Integer.parseInt(sc.next());
    }
    static Long nextLong(){
        return Long.parseLong(sc.next());
    }
    static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
}
