
import java.util.*;


public class Main {
	
	
	public static void main(String[] args) {

		Scanner s = new Scanner(System.in);
		char[] st = s.next().toCharArray();
		int[] a = new int[26];
		for(int i = 0;i<4;i++)
			a[st[i]-'A']++;
		
		int c=  0;
		for(int i=0;i<26;i++)
		{
			if(a[i]>0 && a[i]==2)
				c++;
		}
		if(c==2)System.out.println("Yes");
		else System.out.println("No");
	}
} import java.util.*; util.* java public class Main {
	
	
	public static void main(String[] args) {

		Scanner s = new Scanner(System.in);
		char[] st = s.next().toCharArray();
		int[] a = new int[26];
		for(int i = 0;i<4;i++)
			a[st[i]-'A']++;
		
		int c=  0;
		for(int i=0;i<26;i++)
		{
			if(a[i]>0 && a[i]==2)
				c++;
		}
		if(c==2)System.out.println("Yes");
		else System.out.println("No");
	}
} Main public static void main(String[] args) {

		Scanner s = new Scanner(System.in);
		char[] st = s.next().toCharArray();
		int[] a = new int[26];
		for(int i = 0;i<4;i++)
			a[st[i]-'A']++;
		
		int c=  0;
		for(int i=0;i<26;i++)
		{
			if(a[i]>0 && a[i]==2)
				c++;
		}
		if(c==2)System.out.println("Yes");
		else System.out.println("No");
	} main {

		Scanner s = new Scanner(System.in);
		char[] st = s.next().toCharArray();
		int[] a = new int[26];
		for(int i = 0;i<4;i++)
			a[st[i]-'A']++;
		
		int c=  0;
		for(int i=0;i<26;i++)
		{
			if(a[i]>0 && a[i]==2)
				c++;
		}
		if(c==2)System.out.println("Yes");
		else System.out.println("No");
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) char[] st = s.next().toCharArray(); st s.next().toCharArray() s.next().toCharArray s.next() s.next s int[] a = new int[26]; a new int[26] 26 for(int i = 0;i<4;i++)
			a[st[i]-'A']++; int i = 0; int i = 0; i 0 i<4 i 4 i++ i++ i a[st[i]-'A']++; a[st[i]-'A']++ a[st[i]-'A'] a st[i]-'A' st[i] st i 'A' int c=  0; c 0 for(int i=0;i<26;i++)
		{
			if(a[i]>0 && a[i]==2)
				c++;
		} int i=0; int i=0; i 0 i<26 i 26 i++ i++ i {
			if(a[i]>0 && a[i]==2)
				c++;
		} {
			if(a[i]>0 && a[i]==2)
				c++;
		} if(a[i]>0 && a[i]==2)
				c++; a[i]>0 && a[i]==2 a[i]>0 a[i] a i 0 a[i]==2 a[i] a i 2 c++ c if(c==2)System.out.println("Yes");
		else System.out.println("No"); c==2 c 2 System.out.println("Yes") System.out.println System.out System System.out "Yes" 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 s = new Scanner(System.in);
		char[] st = s.next().toCharArray();
		int[] a = new int[26];
		for(int i = 0;i<4;i++)
			a[st[i]-'A']++;
		
		int c=  0;
		for(int i=0;i<26;i++)
		{
			if(a[i]>0 && a[i]==2)
				c++;
		}
		if(c==2)System.out.println("Yes");
		else System.out.println("No");
	}
} public class Main {
	
	
	public static void main(String[] args) {

		Scanner s = new Scanner(System.in);
		char[] st = s.next().toCharArray();
		int[] a = new int[26];
		for(int i = 0;i<4;i++)
			a[st[i]-'A']++;
		
		int c=  0;
		for(int i=0;i<26;i++)
		{
			if(a[i]>0 && a[i]==2)
				c++;
		}
		if(c==2)System.out.println("Yes");
		else System.out.println("No");
	}
} Main

import java.util.*;


public class Main {
	
	
	public static void main(String[] args) {

		Scanner s = new Scanner(System.in);
		char[] st = s.next().toCharArray();
		int[] a = new int[26];
		for(int i = 0;i<4;i++)
			a[st[i]-'A']++;
		
		int c=  0;
		for(int i=0;i<26;i++)
		{
			if(a[i]>0 && a[i]==2)
				c++;
		}
		if(c==2)System.out.println("Yes");
		else System.out.println("No");
	}
}
