import java.util.*;
import java.io.*;

public class Main
{
	public static void main(String [] Args)
	{
		Scanner in=new Scanner(System.in);		
		String s=in.next();
		int ans=0;
		for(int i=0;i<26;i++)
		{
			int check=0;
			for(int j=0;j<4;j++)
			{
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			}
			if(check!=0&&check!=2)
			{
				ans=1;
			}			
		}
		if(ans==0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}
	 import java.util.*; util.* java import java.io.*; io.* java public class Main
{
	public static void main(String [] Args)
	{
		Scanner in=new Scanner(System.in);		
		String s=in.next();
		int ans=0;
		for(int i=0;i<26;i++)
		{
			int check=0;
			for(int j=0;j<4;j++)
			{
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			}
			if(check!=0&&check!=2)
			{
				ans=1;
			}			
		}
		if(ans==0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
} Main public static void main(String [] Args)
	{
		Scanner in=new Scanner(System.in);		
		String s=in.next();
		int ans=0;
		for(int i=0;i<26;i++)
		{
			int check=0;
			for(int j=0;j<4;j++)
			{
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			}
			if(check!=0&&check!=2)
			{
				ans=1;
			}			
		}
		if(ans==0)
			System.out.println("Yes");
		else
			System.out.println("No");
	} main {
		Scanner in=new Scanner(System.in);		
		String s=in.next();
		int ans=0;
		for(int i=0;i<26;i++)
		{
			int check=0;
			for(int j=0;j<4;j++)
			{
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			}
			if(check!=0&&check!=2)
			{
				ans=1;
			}			
		}
		if(ans==0)
			System.out.println("Yes");
		else
			System.out.println("No");
	} Scanner in=new Scanner(System.in); in new Scanner(System.in) String s=in.next(); s in.next() in.next in int ans=0; ans 0 for(int i=0;i<26;i++)
		{
			int check=0;
			for(int j=0;j<4;j++)
			{
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			}
			if(check!=0&&check!=2)
			{
				ans=1;
			}			
		} int i=0; int i=0; i 0 i<26 i 26 i++ i++ i {
			int check=0;
			for(int j=0;j<4;j++)
			{
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			}
			if(check!=0&&check!=2)
			{
				ans=1;
			}			
		} {
			int check=0;
			for(int j=0;j<4;j++)
			{
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			}
			if(check!=0&&check!=2)
			{
				ans=1;
			}			
		} int check=0; check 0 for(int j=0;j<4;j++)
			{
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			} int j=0; int j=0; j 0 j<4 j 4 j++ j++ j {
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			} {
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			} if(s.charAt(j)-'A'==i)
				{
					check++;					
				} s.charAt(j)-'A'==i s.charAt(j)-'A' s.charAt(j) s.charAt s j 'A' i {
					check++;					
				} check++ check if(check!=0&&check!=2)
			{
				ans=1;
			} check!=0&&check!=2 check!=0 check 0 check!=2 check 2 {
				ans=1;
			} ans=1 ans 1 if(ans==0)
			System.out.println("Yes");
		else
			System.out.println("No"); ans==0 ans 0 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 in=new Scanner(System.in);		
		String s=in.next();
		int ans=0;
		for(int i=0;i<26;i++)
		{
			int check=0;
			for(int j=0;j<4;j++)
			{
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			}
			if(check!=0&&check!=2)
			{
				ans=1;
			}			
		}
		if(ans==0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
} public class Main
{
	public static void main(String [] Args)
	{
		Scanner in=new Scanner(System.in);		
		String s=in.next();
		int ans=0;
		for(int i=0;i<26;i++)
		{
			int check=0;
			for(int j=0;j<4;j++)
			{
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			}
			if(check!=0&&check!=2)
			{
				ans=1;
			}			
		}
		if(ans==0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
} Main
import java.util.*;
import java.io.*;

public class Main
{
	public static void main(String [] Args)
	{
		Scanner in=new Scanner(System.in);		
		String s=in.next();
		int ans=0;
		for(int i=0;i<26;i++)
		{
			int check=0;
			for(int j=0;j<4;j++)
			{
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			}
			if(check!=0&&check!=2)
			{
				ans=1;
			}			
		}
		if(ans==0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}
	