import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "Yes";
		HashMap<Character, Integer> hm = new HashMap<Character, Integer>();
		for(int i = 0; i < s.length(); i++){
		    hm.put(s.charAt(i), hm.getOrDefault(s.charAt(i), 0) + 1);
		}
		for(Integer i : hm.values()){
		    if(i != 2) result = "No";
		}

		// 出力
		System.out.println(result);
	}
} import java.util.*; util.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import java.math.BigInteger; BigInteger java.math public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "Yes";
		HashMap<Character, Integer> hm = new HashMap<Character, Integer>();
		for(int i = 0; i < s.length(); i++){
		    hm.put(s.charAt(i), hm.getOrDefault(s.charAt(i), 0) + 1);
		}
		for(Integer i : hm.values()){
		    if(i != 2) result = "No";
		}

		// 出力
		System.out.println(result);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "Yes";
		HashMap<Character, Integer> hm = new HashMap<Character, Integer>();
		for(int i = 0; i < s.length(); i++){
		    hm.put(s.charAt(i), hm.getOrDefault(s.charAt(i), 0) + 1);
		}
		for(Integer i : hm.values()){
		    if(i != 2) result = "No";
		}

		// 出力
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "Yes";
		HashMap<Character, Integer> hm = new HashMap<Character, Integer>();
		for(int i = 0; i < s.length(); i++){
		    hm.put(s.charAt(i), hm.getOrDefault(s.charAt(i), 0) + 1);
		}
		for(Integer i : hm.values()){
		    if(i != 2) result = "No";
		}

		// 出力
		System.out.println(result);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String result = "Yes"; result "Yes" HashMap<Character, Integer> hm = new HashMap<Character, Integer>(); hm new HashMap<Character, Integer>() for(int i = 0; i < s.length(); i++){
		    hm.put(s.charAt(i), hm.getOrDefault(s.charAt(i), 0) + 1);
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
		    hm.put(s.charAt(i), hm.getOrDefault(s.charAt(i), 0) + 1);
		} {
		    hm.put(s.charAt(i), hm.getOrDefault(s.charAt(i), 0) + 1);
		} hm.put(s.charAt(i), hm.getOrDefault(s.charAt(i), 0) + 1) hm.put hm s.charAt(i) s.charAt s i hm.getOrDefault(s.charAt(i), 0) + 1 hm.getOrDefault(s.charAt(i), 0) hm.getOrDefault hm s.charAt(i) s.charAt s i 0 1 for(Integer i : hm.values()){
		    if(i != 2) result = "No";
		} Integer i hm.values() hm.values hm {
		    if(i != 2) result = "No";
		} {
		    if(i != 2) result = "No";
		} if(i != 2) result = "No"; i != 2 i 2 result = "No" result "No" System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "Yes";
		HashMap<Character, Integer> hm = new HashMap<Character, Integer>();
		for(int i = 0; i < s.length(); i++){
		    hm.put(s.charAt(i), hm.getOrDefault(s.charAt(i), 0) + 1);
		}
		for(Integer i : hm.values()){
		    if(i != 2) result = "No";
		}

		// 出力
		System.out.println(result);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "Yes";
		HashMap<Character, Integer> hm = new HashMap<Character, Integer>();
		for(int i = 0; i < s.length(); i++){
		    hm.put(s.charAt(i), hm.getOrDefault(s.charAt(i), 0) + 1);
		}
		for(Integer i : hm.values()){
		    if(i != 2) result = "No";
		}

		// 出力
		System.out.println(result);
	}
} Main
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "Yes";
		HashMap<Character, Integer> hm = new HashMap<Character, Integer>();
		for(int i = 0; i < s.length(); i++){
		    hm.put(s.charAt(i), hm.getOrDefault(s.charAt(i), 0) + 1);
		}
		for(Integer i : hm.values()){
		    if(i != 2) result = "No";
		}

		// 出力
		System.out.println(result);
	}
}
