local s = io.read("l")
local a, b, c, d = string.byte(s, 1, 4)
if ((a == b) and (c == d)) or
   ((a == c) and (b == d)) or
   ((a == d) and (b == c)) then
   if (a == b) and (a == c) then
       print("No")
   else
       print("Yes")
   end
else
   print("No")
end
