# coding: utf-8

import time

import re

import math

import fractions



def main():

    global N,A,B,C,D,memo,mx,mn,temp

    s=eval(input())

    f=False

    if len(set(list(s)))==2:

        num1=0

        num2=0

        for a in range(4):

            if list(set(list(s)))[0]==s[a]:

                num1+=1

            else:

                num2+=1

        if num1==num2:

            f=True

    if f:

       print("Yes")

    else:

        print("No")



start=time.time()

main()

#print("処理速度 {}sec".format(time.time()-start))

#"YNeos"[True::2]

#A=list(map(int,input().split()))

#A,B,C=map(int,input().split())

#n=int(input())

# global N,A,B,C,D,memo,mx,mn,temp



# coding: utf-8

import time

import re

import math

import fractions



def main():

    s=eval(input())

    if 2==len(set(s)):

        print("Yes")

    else:

        print("No")



start=time.time()

main()

#print("処理速度 {}sec".format(time.time()-start))

#A=list(map(int,input().split()))

#A,B,C=map(int,input().split())

#n=int(input())

# global N,A,B,C,D,memo,mx,mn,temp

# coding: utf-8
import time
import re
import math
import fractions


def main():
    global N, A, B, C, D, memo, mx, mn, temp
    s = eval(input())
    f = False
    if len(set(list(s))) == 2:
        num1 = 0
        num2 = 0
        for a in range(4):
            if list(set(list(s)))[0] == s[a]:
                num1 += 1
            else:
                num2 += 1
        if num1 == num2:
            f = True
    if f:
        print("Yes")
    else:
        print("No")


start = time.time()
main()
# print("処理速度 {}sec".format(time.time()-start))
# "YNeos"[True::2]
# A=list(map(int,input().split()))
# A,B,C=map(int,input().split())
# n=int(input())
# global N,A,B,C,D,memo,mx,mn,temp

# coding: utf-8
import time
import re
import math
import fractions


def main():
    s = eval(input())
    if 2 == len(set(s)):
        print("Yes")
    else:
        print("No")


start = time.time()
main()
# print("処理速度 {}sec".format(time.time()-start))
# A=list(map(int,input().split()))
# A,B,C=map(int,input().split())
# n=int(input())
# global N,A,B,C,D,memo,mx,mn,temp

-    global N, A, B, C, D, memo, mx, mn, temp -    f = False -    if len(set(list(s))) == 2: -        num1 = 0 -        num2 = 0 -        for a in range(4): -            if list(set(list(s)))[0] == s[a]: -                num1 += 1 -            else: -                num2 += 1 -        if num1 == num2: -            f = True -    if f: +    if 2 == len(set(s)): -# "YNeos"[True::2]