import java.util.*;

public class Main{
	public static void main(String args[]){
    	Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String str[] = new String[S.length()];
        for( int i = 0 ; i < S.length() ; i++ ){
            str[i] = String.valueOf(S.charAt(i));
        }
        Arrays.sort(str);
        String bol = str[0].equals(str[1]) && !(str[1].equals(str[2])) && str[2].equals(str[3]) ? "Yes" : "No" ;
        System.out.println(bol);
	}
} import java.util.*; util.* java public class Main{
	public static void main(String args[]){
    	Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String str[] = new String[S.length()];
        for( int i = 0 ; i < S.length() ; i++ ){
            str[i] = String.valueOf(S.charAt(i));
        }
        Arrays.sort(str);
        String bol = str[0].equals(str[1]) && !(str[1].equals(str[2])) && str[2].equals(str[3]) ? "Yes" : "No" ;
        System.out.println(bol);
	}
} Main public static void main(String args[]){
    	Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String str[] = new String[S.length()];
        for( int i = 0 ; i < S.length() ; i++ ){
            str[i] = String.valueOf(S.charAt(i));
        }
        Arrays.sort(str);
        String bol = str[0].equals(str[1]) && !(str[1].equals(str[2])) && str[2].equals(str[3]) ? "Yes" : "No" ;
        System.out.println(bol);
	} main {
    	Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String str[] = new String[S.length()];
        for( int i = 0 ; i < S.length() ; i++ ){
            str[i] = String.valueOf(S.charAt(i));
        }
        Arrays.sort(str);
        String bol = str[0].equals(str[1]) && !(str[1].equals(str[2])) && str[2].equals(str[3]) ? "Yes" : "No" ;
        System.out.println(bol);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan String str[] = new String[S.length()]; str new String[S.length()] S.length() S.length S for( int i = 0 ; i < S.length() ; i++ ){
            str[i] = String.valueOf(S.charAt(i));
        } int i = 0 ; int i = 0 ; i 0 i < S.length() i S.length() S.length S i++ i++ i {
            str[i] = String.valueOf(S.charAt(i));
        } {
            str[i] = String.valueOf(S.charAt(i));
        } str[i] = String.valueOf(S.charAt(i)) str[i] str i String.valueOf(S.charAt(i)) String.valueOf String S.charAt(i) S.charAt S i Arrays.sort(str) Arrays.sort Arrays str String bol = str[0].equals(str[1]) && !(str[1].equals(str[2])) && str[2].equals(str[3]) ? "Yes" : "No" ; bol str[0].equals(str[1]) && !(str[1].equals(str[2])) && str[2].equals(str[3]) ? "Yes" : "No" str[0].equals(str[1]) && !(str[1].equals(str[2])) && str[2].equals(str[3]) str[0].equals(str[1]) && !(str[1].equals(str[2])) && str[2].equals(str[3]) str[0].equals(str[1]) str[0].equals str[0] str 0 str[1] str 1 !(str[1].equals(str[2])) (str[1].equals(str[2])) str[1].equals str[1] str 1 str[2] str 2 str[2].equals(str[3]) str[2].equals str[2] str 2 str[3] str 3 "Yes" "No" System.out.println(bol) System.out.println System.out System System.out bol String args[] args public class Main{
	public static void main(String args[]){
    	Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String str[] = new String[S.length()];
        for( int i = 0 ; i < S.length() ; i++ ){
            str[i] = String.valueOf(S.charAt(i));
        }
        Arrays.sort(str);
        String bol = str[0].equals(str[1]) && !(str[1].equals(str[2])) && str[2].equals(str[3]) ? "Yes" : "No" ;
        System.out.println(bol);
	}
} public class Main{
	public static void main(String args[]){
    	Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String str[] = new String[S.length()];
        for( int i = 0 ; i < S.length() ; i++ ){
            str[i] = String.valueOf(S.charAt(i));
        }
        Arrays.sort(str);
        String bol = str[0].equals(str[1]) && !(str[1].equals(str[2])) && str[2].equals(str[3]) ? "Yes" : "No" ;
        System.out.println(bol);
	}
} Main
import java.util.*;

public class Main{
	public static void main(String args[]){
    	Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String str[] = new String[S.length()];
        for( int i = 0 ; i < S.length() ; i++ ){
            str[i] = String.valueOf(S.charAt(i));
        }
        Arrays.sort(str);
        String bol = str[0].equals(str[1]) && !(str[1].equals(str[2])) && str[2].equals(str[3]) ? "Yes" : "No" ;
        System.out.println(bol);
	}
}