import java.io.BufferedReader;
import java.io.Console;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.StringTokenizer;
import java.util.TreeMap;

import javax.naming.ldap.SortControl;

public class Main {

	static FastReader input = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) throws IOException {
		String s = input.nextLine();
		int[] a = new int[60];
		for (int i = 0; i < s.length(); i++) {
			a[s.charAt(i) - 'A']++;
		}

		boolean isOk = true;
		for (int i = 0; i < a.length; i++) {
			if (a[i] != 0 && a[i] != 2) {
				isOk = false;
				break;
			}
		}
		out.println(isOk ? "Yes" : "No");
		out.flush();
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		String nextLine() throws IOException {
			String str = "";
			str = br.readLine();
			return str;
		}
	}

	static class con {
		static int IINF = (int) 1e9;
		static int _IINF = (int) -1e9;
		static long LINF = (long) 1e15;
		static long _LINF = (long) -1e15;
		static double EPS = 1e-9;
	}

	static class Triple implements Comparable<Triple> {
		int x;
		int y;
		int z;

		Triple(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}

		@Override
		public int compareTo(Triple o) {
			if (x == o.x && y == o.y)
				return z - o.z;
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	}

	static class Pair implements Comparable<Pair> {
		int x;
		int y;

		Pair(int x, int y) {
			this.x = x;
			this.y = y;

		}

		@Override
		public int compareTo(Pair o) {
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	}

	static void shuffle(int[] a) {
		for (int i = 0; i < a.length; i++) {
			int r = i + (int) (Math.random() * (a.length - i));
			int tmp = a[r];
			a[r] = a[i];
			a[i] = tmp;
		}
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.Console; Console java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util import java.util.StringTokenizer; StringTokenizer java.util import java.util.TreeMap; TreeMap java.util import javax.naming.ldap.SortControl; SortControl javax.naming.ldap public class Main {

	static FastReader input = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) throws IOException {
		String s = input.nextLine();
		int[] a = new int[60];
		for (int i = 0; i < s.length(); i++) {
			a[s.charAt(i) - 'A']++;
		}

		boolean isOk = true;
		for (int i = 0; i < a.length; i++) {
			if (a[i] != 0 && a[i] != 2) {
				isOk = false;
				break;
			}
		}
		out.println(isOk ? "Yes" : "No");
		out.flush();
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		String nextLine() throws IOException {
			String str = "";
			str = br.readLine();
			return str;
		}
	}

	static class con {
		static int IINF = (int) 1e9;
		static int _IINF = (int) -1e9;
		static long LINF = (long) 1e15;
		static long _LINF = (long) -1e15;
		static double EPS = 1e-9;
	}

	static class Triple implements Comparable<Triple> {
		int x;
		int y;
		int z;

		Triple(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}

		@Override
		public int compareTo(Triple o) {
			if (x == o.x && y == o.y)
				return z - o.z;
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	}

	static class Pair implements Comparable<Pair> {
		int x;
		int y;

		Pair(int x, int y) {
			this.x = x;
			this.y = y;

		}

		@Override
		public int compareTo(Pair o) {
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	}

	static void shuffle(int[] a) {
		for (int i = 0; i < a.length; i++) {
			int r = i + (int) (Math.random() * (a.length - i));
			int tmp = a[r];
			a[r] = a[i];
			a[i] = tmp;
		}
	}

} Main static FastReader input = new FastReader(); input new FastReader() static PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) public static void main(String[] args) throws IOException {
		String s = input.nextLine();
		int[] a = new int[60];
		for (int i = 0; i < s.length(); i++) {
			a[s.charAt(i) - 'A']++;
		}

		boolean isOk = true;
		for (int i = 0; i < a.length; i++) {
			if (a[i] != 0 && a[i] != 2) {
				isOk = false;
				break;
			}
		}
		out.println(isOk ? "Yes" : "No");
		out.flush();
	} main {
		String s = input.nextLine();
		int[] a = new int[60];
		for (int i = 0; i < s.length(); i++) {
			a[s.charAt(i) - 'A']++;
		}

		boolean isOk = true;
		for (int i = 0; i < a.length; i++) {
			if (a[i] != 0 && a[i] != 2) {
				isOk = false;
				break;
			}
		}
		out.println(isOk ? "Yes" : "No");
		out.flush();
	} String s = input.nextLine(); s input.nextLine() input.nextLine input int[] a = new int[60]; a new int[60] 60 for (int i = 0; i < s.length(); i++) {
			a[s.charAt(i) - 'A']++;
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			a[s.charAt(i) - 'A']++;
		} {
			a[s.charAt(i) - 'A']++;
		} a[s.charAt(i) - 'A']++ a[s.charAt(i) - 'A'] a s.charAt(i) - 'A' s.charAt(i) s.charAt s i 'A' boolean isOk = true; isOk true for (int i = 0; i < a.length; i++) {
			if (a[i] != 0 && a[i] != 2) {
				isOk = false;
				break;
			}
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			if (a[i] != 0 && a[i] != 2) {
				isOk = false;
				break;
			}
		} {
			if (a[i] != 0 && a[i] != 2) {
				isOk = false;
				break;
			}
		} if (a[i] != 0 && a[i] != 2) {
				isOk = false;
				break;
			} a[i] != 0 && a[i] != 2 a[i] != 0 a[i] a i 0 a[i] != 2 a[i] a i 2 {
				isOk = false;
				break;
			} isOk = false isOk false break; out.println(isOk ? "Yes" : "No") out.println out isOk ? "Yes" : "No" isOk "Yes" "No" out.flush() out.flush out String[] args args static void shuffle(int[] a) {
		for (int i = 0; i < a.length; i++) {
			int r = i + (int) (Math.random() * (a.length - i));
			int tmp = a[r];
			a[r] = a[i];
			a[i] = tmp;
		}
	} shuffle {
		for (int i = 0; i < a.length; i++) {
			int r = i + (int) (Math.random() * (a.length - i));
			int tmp = a[r];
			a[r] = a[i];
			a[i] = tmp;
		}
	} for (int i = 0; i < a.length; i++) {
			int r = i + (int) (Math.random() * (a.length - i));
			int tmp = a[r];
			a[r] = a[i];
			a[i] = tmp;
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			int r = i + (int) (Math.random() * (a.length - i));
			int tmp = a[r];
			a[r] = a[i];
			a[i] = tmp;
		} {
			int r = i + (int) (Math.random() * (a.length - i));
			int tmp = a[r];
			a[r] = a[i];
			a[i] = tmp;
		} int r = i + (int) (Math.random() * (a.length - i)); r i + (int) (Math.random() * (a.length - i)) i (int) (Math.random() * (a.length - i)) Math.random() Math.random Math (a.length - i) a.length a a.length i int tmp = a[r]; tmp a[r] a r a[r] = a[i] a[r] a r a[i] a i a[i] = tmp a[i] a i tmp int[] a a static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		String nextLine() throws IOException {
			String str = "";
			str = br.readLine();
			return str;
		}
	} FastReader BufferedReader br; br StringTokenizer st; st public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		} FastReader {
			br = new BufferedReader(new InputStreamReader(System.in));
		} br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) String next() throws IOException {
			while (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		} next {
			while (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		} while (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(br.readLine());
			} st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {
				st = new StringTokenizer(br.readLine());
			} st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		} nextInt {
			return Integer.parseInt(next());
		} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		} nextLong {
			return Long.parseLong(next());
		} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		} nextDouble {
			return Double.parseDouble(next());
		} return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next String nextLine() throws IOException {
			String str = "";
			str = br.readLine();
			return str;
		} nextLine {
			String str = "";
			str = br.readLine();
			return str;
		} String str = ""; str "" str = br.readLine() str br.readLine() br.readLine br return str; str static class con {
		static int IINF = (int) 1e9;
		static int _IINF = (int) -1e9;
		static long LINF = (long) 1e15;
		static long _LINF = (long) -1e15;
		static double EPS = 1e-9;
	} con static int IINF = (int) 1e9; IINF (int) 1e9 static int _IINF = (int) -1e9; _IINF (int) -1e9 1e9 static long LINF = (long) 1e15; LINF (long) 1e15 static long _LINF = (long) -1e15; _LINF (long) -1e15 1e15 static double EPS = 1e-9; EPS 1e-9 static class Triple implements Comparable<Triple> {
		int x;
		int y;
		int z;

		Triple(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}

		@Override
		public int compareTo(Triple o) {
			if (x == o.x && y == o.y)
				return z - o.z;
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	} Triple int x; x int y; y int z; z Triple(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
		} Triple {
			this.x = x;
			this.y = y;
			this.z = z;
		} this.x = x this.x this this.x x this.y = y this.y this this.y y this.z = z this.z this this.z z int x x int y y int z z @Override
		public int compareTo(Triple o) {
			if (x == o.x && y == o.y)
				return z - o.z;
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		} compareTo {
			if (x == o.x && y == o.y)
				return z - o.z;
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		} if (x == o.x && y == o.y)
				return z - o.z; x == o.x && y == o.y x == o.x x o.x o o.x y == o.y y o.y o o.y return z - o.z; z - o.z z o.z o o.z if (x == o.x)
				return y - o.y; x == o.x x o.x o o.x return y - o.y; y - o.y y o.y o o.y return x - o.x; x - o.x x o.x o o.x Triple o o Comparable static class Pair implements Comparable<Pair> {
		int x;
		int y;

		Pair(int x, int y) {
			this.x = x;
			this.y = y;

		}

		@Override
		public int compareTo(Pair o) {
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	} Pair int x; x int y; y Pair(int x, int y) {
			this.x = x;
			this.y = y;

		} Pair {
			this.x = x;
			this.y = y;

		} this.x = x this.x this this.x x this.y = y this.y this this.y y int x x int y y @Override
		public int compareTo(Pair o) {
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		} compareTo {
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		} if (x == o.x)
				return y - o.y; x == o.x x o.x o o.x return y - o.y; y - o.y y o.y o o.y return x - o.x; x - o.x x o.x o o.x Pair o o Comparable public class Main {

	static FastReader input = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) throws IOException {
		String s = input.nextLine();
		int[] a = new int[60];
		for (int i = 0; i < s.length(); i++) {
			a[s.charAt(i) - 'A']++;
		}

		boolean isOk = true;
		for (int i = 0; i < a.length; i++) {
			if (a[i] != 0 && a[i] != 2) {
				isOk = false;
				break;
			}
		}
		out.println(isOk ? "Yes" : "No");
		out.flush();
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		String nextLine() throws IOException {
			String str = "";
			str = br.readLine();
			return str;
		}
	}

	static class con {
		static int IINF = (int) 1e9;
		static int _IINF = (int) -1e9;
		static long LINF = (long) 1e15;
		static long _LINF = (long) -1e15;
		static double EPS = 1e-9;
	}

	static class Triple implements Comparable<Triple> {
		int x;
		int y;
		int z;

		Triple(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}

		@Override
		public int compareTo(Triple o) {
			if (x == o.x && y == o.y)
				return z - o.z;
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	}

	static class Pair implements Comparable<Pair> {
		int x;
		int y;

		Pair(int x, int y) {
			this.x = x;
			this.y = y;

		}

		@Override
		public int compareTo(Pair o) {
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	}

	static void shuffle(int[] a) {
		for (int i = 0; i < a.length; i++) {
			int r = i + (int) (Math.random() * (a.length - i));
			int tmp = a[r];
			a[r] = a[i];
			a[i] = tmp;
		}
	}

} public class Main {

	static FastReader input = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) throws IOException {
		String s = input.nextLine();
		int[] a = new int[60];
		for (int i = 0; i < s.length(); i++) {
			a[s.charAt(i) - 'A']++;
		}

		boolean isOk = true;
		for (int i = 0; i < a.length; i++) {
			if (a[i] != 0 && a[i] != 2) {
				isOk = false;
				break;
			}
		}
		out.println(isOk ? "Yes" : "No");
		out.flush();
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		String nextLine() throws IOException {
			String str = "";
			str = br.readLine();
			return str;
		}
	}

	static class con {
		static int IINF = (int) 1e9;
		static int _IINF = (int) -1e9;
		static long LINF = (long) 1e15;
		static long _LINF = (long) -1e15;
		static double EPS = 1e-9;
	}

	static class Triple implements Comparable<Triple> {
		int x;
		int y;
		int z;

		Triple(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}

		@Override
		public int compareTo(Triple o) {
			if (x == o.x && y == o.y)
				return z - o.z;
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	}

	static class Pair implements Comparable<Pair> {
		int x;
		int y;

		Pair(int x, int y) {
			this.x = x;
			this.y = y;

		}

		@Override
		public int compareTo(Pair o) {
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	}

	static void shuffle(int[] a) {
		for (int i = 0; i < a.length; i++) {
			int r = i + (int) (Math.random() * (a.length - i));
			int tmp = a[r];
			a[r] = a[i];
			a[i] = tmp;
		}
	}

} Main
import java.io.BufferedReader;
import java.io.Console;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.StringTokenizer;
import java.util.TreeMap;

import javax.naming.ldap.SortControl;

public class Main {

	static FastReader input = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) throws IOException {
		String s = input.nextLine();
		int[] a = new int[60];
		for (int i = 0; i < s.length(); i++) {
			a[s.charAt(i) - 'A']++;
		}

		boolean isOk = true;
		for (int i = 0; i < a.length; i++) {
			if (a[i] != 0 && a[i] != 2) {
				isOk = false;
				break;
			}
		}
		out.println(isOk ? "Yes" : "No");
		out.flush();
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		String nextLine() throws IOException {
			String str = "";
			str = br.readLine();
			return str;
		}
	}

	static class con {
		static int IINF = (int) 1e9;
		static int _IINF = (int) -1e9;
		static long LINF = (long) 1e15;
		static long _LINF = (long) -1e15;
		static double EPS = 1e-9;
	}

	static class Triple implements Comparable<Triple> {
		int x;
		int y;
		int z;

		Triple(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}

		@Override
		public int compareTo(Triple o) {
			if (x == o.x && y == o.y)
				return z - o.z;
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	}

	static class Pair implements Comparable<Pair> {
		int x;
		int y;

		Pair(int x, int y) {
			this.x = x;
			this.y = y;

		}

		@Override
		public int compareTo(Pair o) {
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	}

	static void shuffle(int[] a) {
		for (int i = 0; i < a.length; i++) {
			int r = i + (int) (Math.random() * (a.length - i));
			int tmp = a[r];
			a[r] = a[i];
			a[i] = tmp;
		}
	}

}