s = list(eval(input()))

s.sort()

flg = (s[0] == s[1]) and (s[1] != s[2]) and (s[2] == s[3])

print(('Yes' if flg else 'No'))

def main():

    *s, = eval(input())

    s.sort()

    cond = s[0] == s[1] and s[1] != s[2] and s[2] == s[3]

    print(('Yes' if cond else 'No'))





if __name__ == '__main__':

    main()

s = list(eval(input()))
s.sort()
flg = (s[0] == s[1]) and (s[1] != s[2]) and (s[2] == s[3])
print(("Yes" if flg else "No"))

def main():
    (*s,) = eval(input())
    s.sort()
    cond = s[0] == s[1] and s[1] != s[2] and s[2] == s[3]
    print(("Yes" if cond else "No"))


if __name__ == "__main__":
    main()

-s = list(eval(input())) -s.sort() -flg = (s[0] == s[1]) and (s[1] != s[2]) and (s[2] == s[3]) -print(("Yes" if flg else "No")) +def main(): +    (*s,) = eval(input()) +    s.sort() +    cond = s[0] == s[1] and s[1] != s[2] and s[2] == s[3] +    print(("Yes" if cond else "No")) + + +if __name__ == "__main__": +    main()