import collections

S = eval(input())

c = collections.Counter(S)

x = c.most_common()

if x[0][1] == 2:

    if x[1][1] == 2:

        print('Yes')

    else:

        print('No')

else:

    print('No')
s = eval(input())

for a in s:

    if s.count(a) != 2:

        print('No')

        break

else:

    print('Yes')
import collections

S = eval(input())
c = collections.Counter(S)
x = c.most_common()
if x[0][1] == 2:
    if x[1][1] == 2:
        print("Yes")
    else:
        print("No")
else:
    print("No")

s = eval(input())
for a in s:
    if s.count(a) != 2:
        print("No")
        break
else:
    print("Yes")

-import collections - -S = eval(input()) -c = collections.Counter(S) -x = c.most_common() -if x[0][1] == 2: -    if x[1][1] == 2: -        print("Yes") -    else: +s = eval(input()) +for a in s: +    if s.count(a) != 2: +        break -    print("No") +    print("Yes")