AtCoder Beginner Contest 158 - Station and Bus

In AtCoder City, there are three stations numbered 1, 2, and 3.
Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is A, Company A operates Station i; if S_i is B, Company B operates Station i.
To improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.
Determine if there is a pair of stations that will be connected by a bus service.

-----Constraints-----
 - Each character of S is A or B.
 - |S| = 3

-----Input-----
Input is given from Standard Input in the following format:
S

-----Output-----
If there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.

-----Sample Input-----
ABA

-----Sample Output-----
Yes

Company A operates Station 1 and 3, while Company B operates Station 2.
There will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.

Difficulty: EASY

Starter code:

Solutions:
print('NYoe s'[len(set(input())) == 2::2])


S = input()
if S[0] == S[1] and S[1] == S[2]:
	print('No')
else:
	print('Yes')


s = list(input())
print('Yes' if len(set(s)) == 2 else 'No')


print('YNeos'[len({*input()}) < 2::2])


print('Yes' if len(set(input())) != 1 else 'No')


moji = str(input())
print(('No', 'Yes')['B' in moji and 'A' in moji])


s = input()
if s == 'AAA' or s == 'BBB':
	print('No')
else:
	print('Yes')


S = input()
if 'AB' in S or 'BA' in S:
	print('Yes')
else:
	print('No')


s = input()
print(['Yes', 'No'][s[0] == s[1] == s[2]])


S = input()
print('Yes' if len(list(set(S))) == 2 else 'No')


S = input()
ans = set(S)
print('Yes' if len(ans) >= 2 else 'No')


s = input()
if 'A' in s and 'B' in s:
	print('Yes')
else:
	print('No')


S = input()
print('Yes' if 'A' in S and 'B' in S else 'No')


print('YNeos'[len(set(list(input()))) == 1::2])


c = input().count('A')
print('No' if c == 3 or c == 0 else 'Yes')


print(['No', 'Yes'][len(set(input())) - 1])


print('No') if input().count('A') in [0, 3] else print('Yes')


x = input()
print(['Yes', 'No'][(x == 'AAA') | (x == 'BBB')])


S = str(input())
if S == 'AAA' or S == 'BBB':
	print('No')
else:
	print('Yes')


s = input()
count = s.count('B')
if count == 3 or count == 0:
	print('No')
else:
	print('Yes')


s = input()
print('Yes' if 'AB' in s or 'BA' in s else 'No')


M = input()
print('No' if M[0] == M[1] == M[2] else 'Yes')


S = input()
st = set(S)
print('Yes' if len(st) == 2 else 'No')


print('Yes') if len(set(input())) == 2 else print('No')


print('YNeos'[input() in ['AAA', 'BBB']::2])


s = input()
print('No' if len(set(list(s))) == 1 else 'Yes')


def main():
	chars = input()
	if chars[0] == chars[1] and chars[1] == chars[2]:
		print('No')
	else:
		print('Yes')
main()


print('YNeos'[2 - len(set(input()))::2])


S = list(map(str, input()))
if S[0] != S[1] or S[1] != S[2]:
	print('Yes')
else:
	print('No')


S = input()
print('Yes' if S != 'AAA' and S != 'BBB' else 'No')


S = input()
if abs(S.count('A') - S.count('B')) != 3:
	print('Yes')
else:
	print('No')


S = str(input())
if S[0] == S[1] == S[2]:
	print('No')
else:
	print('Yes')


a = input()
print('No' if a == 'AAA' or a == 'BBB' else 'Yes')


print('No') if input() in ['AAA', 'BBB'] else print('Yes')


s = input()
ans = 'Yes' if len(set(s)) > 1 else 'No'
print(ans)


s = input()
print('YNeos'[s == 'AAA' or s == 'BBB'::2])


s = input()
s_count_A = s.count('A')
if s_count_A == 0 or s_count_A == 3:
	ans = 'No'
else:
	ans = 'Yes'
print(ans)


s = len(set((i for i in input())))
print('YNeos'[s == 1::2])


Station = []
Station = input()
if Station == 'AAA':
	print('No')
elif Station == 'BBB':
	print('No')
else:
	print('Yes')


s = list(input())
if s[1] == 'A' and s[0] == 'A' and (s[2] == 'A'):
	print('No')
elif s[1] == 'B' and s[0] == 'B' and (s[2] == 'B'):
	print('No')
else:
	print('Yes')


S = input()
print('Yes') if len(set(list(S))) != 1 else print('No')


S = input()
print('YNeos'[not (S[0] != S[1] or S[1] != S[2])::2])


s = input()
print('NYoe s'['A' in s and 'B' in s::2])


S = input()
ans = 'Yes'
if not 'A' in S:
	ans = 'No'
if not 'B' in S:
	ans = 'No'
print(ans)


S = input()
if S[0] == S[1] and S[1] == S[2]:
	print('No')
	return
print('Yes')


S = input()
if S == 'AAA':
	print('No')
elif S == 'AAB':
	print('Yes')
elif S == 'ABA':
	print('Yes')
elif S == 'BAA':
	print('Yes')
elif S == 'ABB':
	print('Yes')
elif S == 'BAB':
	print('Yes')
elif S == 'BBA':
	print('Yes')
elif S == 'BBB':
	print('No')


def main():
	s = input()
	return 'Yes' if len(set(s)) == 2 else 'No'

def __starting_point():
	print(main())
__starting_point()


S = input()
sets = set(S)
print('Yes' if len(sets) == 2 else 'No')


s = list(input())
if s[0] == s[1] and s[0] == s[2]:
	print('No')
else:
	print('Yes')


print('NYoe s'['AAA' < input() < 'BBB'::2])


S = set(input().strip())
print('Yes' if len(S) > 1 else 'No')


s = input()
if s == 'AAA':
	print('No')
elif s == 'BBB':
	print('No')
else:
	print('Yes')


print(['No', 'Yes', 'Yes', 'No'][sum([s == 'A' for s in input()])])


s = input()
print('Yes' if s != 'AAA' and s != 'BBB' else 'No')


S = input()
print('No' if S in ['A' * 3, 'B' * 3] else 'Yes')


a = input()
print('Yes' if 'A' in a and 'B' in a else 'No')


a = input()
print('No' if a[0] == a[1] == a[2] else 'Yes')


s = input()
print('Yes' if s[0] != s[1] or s[1] != s[2] else 'No')


s = set([i for i in input()])
print('Yes' if len(s) == 2 else 'No')


S = input()
S = list(S)
if S[0] == S[1] == S[2]:
	print('No')
else:
	print('Yes')


from collections import Counter
s = input()
s = Counter(s)
if len(s) == 1:
	print('No')
else:
	print('Yes')


print('Yes' if len(set(list(input().strip()))) - 1 else 'No')


print('Yes' if ['A', 'B'] == sorted(set(input())) else 'No')


s = input()
print('YNeos'[s == len(s) * s[0]::2])


import os, sys, re, math
S = input()
if S == 'AAA' or S == 'BBB':
	print('No')
else:
	print('Yes')


def resolve():
	s = input()
	if s.count('A') == 0 or s.count('B') == 0:
		print('No')
	else:
		print('Yes')
resolve()


from sys import stdin, stdout
for _ in range(1):
	s = len(set(input()))
	print('Yes' if s > 1 else 'No')


(a, b, c) = input()
print('No' if a == b == c else 'Yes')


d = input()
if d == 'AAA' or d == 'BBB':
	print('No')
else:
	print('Yes')


s = str(input())
if s[0] == 'A':
	t = 'B'
else:
	t = 'A'
answer = s.find(t)
if answer != -1:
	print('Yes')
else:
	print('No')


def main():
	s = input()
	if s in 'AAA' or s in 'BBB':
		print('No')
	else:
		print('Yes')

def __starting_point():
	main()
__starting_point()


S = list(input())
S_sorted = ''.join(sorted(S))
if S_sorted == 'AAA' or S_sorted == 'BBB':
	print('No')
else:
	print('Yes')


def readinput():
	s = input()
	return s

def main(s):
	if s == 'AAA' or s == 'BBB':
		return 'No'
	else:
		return 'Yes'

def __starting_point():
	s = readinput()
	ans = main(s)
	print(ans)
__starting_point()


S = input()
print('YNeos'[S[0] == S[1] == S[2]::2])


S = input()
list = []
t = 0
while t <= 2:
	list.append(S[t])
	t = t + 1
if len(set(list)) == 1:
	print('No')
else:
	print('Yes')


i = input()
print('YNeos'[i == 'AAA' or i == 'BBB'::2])


x = set(list(input()))
print('No' if len(x) == 1 else 'Yes')


x = list(input())
print('Yes' if len(set(x)) == 2 else 'No')


Ss = input().rstrip()
if Ss in ['AAA', 'BBB']:
	print('No')
else:
	print('Yes')


N = input()
print(('Yes', 'No')[N[0] == N[1] == N[2]])


def atc_158a(input_value: str) -> str:
	if input_value == 'AAA' or input_value == 'BBB':
		return 'No'
	return 'Yes'
input_value = input()
print(atc_158a(input_value))


S = input()
print('Yes' if S not in ['AAA', 'BBB'] else 'No')


S = input()
print(['No', 'Yes'][not (S == 'AAA' or S == 'BBB')])


s = list(input())
if s.count('A') == 0 or s.count('B') == 0:
	print('No')
else:
	print('Yes')


s = input()
for i in range(2):
	if s[i] != s[i + 1]:
		print('Yes')
		break
else:
	print('No')


S = input()
if S.count('A') == 3 or S.count('B') == 3:
	print('No')
else:
	print('Yes')


S = input()
if S.count('A') == 2 and S.count('B') == 1 or (S.count('A') == 1 and S.count('B') == 2):
	print('Yes')
else:
	print('No')


S = set(input())
n = len(S)
print('Yes' if n > 1 else 'No')


s = input()
res = 'Yes' if len(set(s)) != 1 else 'No'
print(res)


S = input()
N = len(set(S))
print('No' if N == 1 else 'Yes')


(a, b, c) = input()
print('YNeos'[a == b == c::2])


print('NYoe s'[{'A', 'B'} <= set(input())::2])


S = input()
print(['Yes', 'No'][S in ['AAA', 'BBB']])


a = list(input())
print('Yes' if len(set(a)) == 2 else 'No')