import java.util.Scanner;
import java.util.HashMap;
public class Main {

    public static void main(String[] args) {
        Scanner Ent = new Scanner(System.in);
        String palabra = Ent.next();
        HashMap tablaHash = new HashMap();
        char arreglo[] =palabra.toCharArray();
        for (int i = 0; i < arreglo.length; i++) {
            if(!tablaHash.containsKey(arreglo[i])){
                tablaHash.put(arreglo[i], arreglo[i]);
            }
        }
        if(tablaHash.size() == 2){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
    
} import java.util.Scanner; Scanner java.util import java.util.HashMap; HashMap java.util public class Main {

    public static void main(String[] args) {
        Scanner Ent = new Scanner(System.in);
        String palabra = Ent.next();
        HashMap tablaHash = new HashMap();
        char arreglo[] =palabra.toCharArray();
        for (int i = 0; i < arreglo.length; i++) {
            if(!tablaHash.containsKey(arreglo[i])){
                tablaHash.put(arreglo[i], arreglo[i]);
            }
        }
        if(tablaHash.size() == 2){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
    
} Main public static void main(String[] args) {
        Scanner Ent = new Scanner(System.in);
        String palabra = Ent.next();
        HashMap tablaHash = new HashMap();
        char arreglo[] =palabra.toCharArray();
        for (int i = 0; i < arreglo.length; i++) {
            if(!tablaHash.containsKey(arreglo[i])){
                tablaHash.put(arreglo[i], arreglo[i]);
            }
        }
        if(tablaHash.size() == 2){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        Scanner Ent = new Scanner(System.in);
        String palabra = Ent.next();
        HashMap tablaHash = new HashMap();
        char arreglo[] =palabra.toCharArray();
        for (int i = 0; i < arreglo.length; i++) {
            if(!tablaHash.containsKey(arreglo[i])){
                tablaHash.put(arreglo[i], arreglo[i]);
            }
        }
        if(tablaHash.size() == 2){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner Ent = new Scanner(System.in); Ent new Scanner(System.in) String palabra = Ent.next(); palabra Ent.next() Ent.next Ent HashMap tablaHash = new HashMap(); tablaHash new HashMap() char arreglo[] =palabra.toCharArray(); arreglo palabra.toCharArray() palabra.toCharArray palabra for (int i = 0; i < arreglo.length; i++) {
            if(!tablaHash.containsKey(arreglo[i])){
                tablaHash.put(arreglo[i], arreglo[i]);
            }
        } int i = 0; int i = 0; i 0 i < arreglo.length i arreglo.length arreglo arreglo.length i++ i++ i {
            if(!tablaHash.containsKey(arreglo[i])){
                tablaHash.put(arreglo[i], arreglo[i]);
            }
        } {
            if(!tablaHash.containsKey(arreglo[i])){
                tablaHash.put(arreglo[i], arreglo[i]);
            }
        } if(!tablaHash.containsKey(arreglo[i])){
                tablaHash.put(arreglo[i], arreglo[i]);
            } !tablaHash.containsKey(arreglo[i]) tablaHash.containsKey(arreglo[i]) tablaHash.containsKey tablaHash arreglo[i] arreglo i {
                tablaHash.put(arreglo[i], arreglo[i]);
            } tablaHash.put(arreglo[i], arreglo[i]) tablaHash.put tablaHash arreglo[i] arreglo i arreglo[i] arreglo i if(tablaHash.size() == 2){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } tablaHash.size() == 2 tablaHash.size() tablaHash.size tablaHash 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) {
        Scanner Ent = new Scanner(System.in);
        String palabra = Ent.next();
        HashMap tablaHash = new HashMap();
        char arreglo[] =palabra.toCharArray();
        for (int i = 0; i < arreglo.length; i++) {
            if(!tablaHash.containsKey(arreglo[i])){
                tablaHash.put(arreglo[i], arreglo[i]);
            }
        }
        if(tablaHash.size() == 2){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
    
} public class Main {

    public static void main(String[] args) {
        Scanner Ent = new Scanner(System.in);
        String palabra = Ent.next();
        HashMap tablaHash = new HashMap();
        char arreglo[] =palabra.toCharArray();
        for (int i = 0; i < arreglo.length; i++) {
            if(!tablaHash.containsKey(arreglo[i])){
                tablaHash.put(arreglo[i], arreglo[i]);
            }
        }
        if(tablaHash.size() == 2){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
    
} Main
import java.util.Scanner;
import java.util.HashMap;
public class Main {

    public static void main(String[] args) {
        Scanner Ent = new Scanner(System.in);
        String palabra = Ent.next();
        HashMap tablaHash = new HashMap();
        char arreglo[] =palabra.toCharArray();
        for (int i = 0; i < arreglo.length; i++) {
            if(!tablaHash.containsKey(arreglo[i])){
                tablaHash.put(arreglo[i], arreglo[i]);
            }
        }
        if(tablaHash.size() == 2){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
    
}
