The RPS world championship is here. Here two players A and B play the game. You need to determine who wins.
Both players can choose moves from the set {R,P,S}.
The game is a draw if both players choose the same item. 
The winning rules of RPS are given below:
	Rock crushes scissor
	Scissor cuts paper
	Paper envelops rock
 
Example 1:
Input:
S = "RR"
Output: DRAW
Explanation: Both A and B chooses a Rock.
Hence, it's a draw.
Ã¢â¬â¹Example 2:
Input: 
S = "RS"
Output: A
Explanation: A chose a Rock whereas B chose
a Scissor. Rock crushes the Scissor and thus, 
A wins.
Your Task:
You don't need to read input or print anything. Your task is to complete the function gameResult() which takes the string S as input and returns a string denoting the answer. Return "A" if A wins, "B" if B wins and "DRAW" if it's a draw.
Expected Time Complexity: O(1).
Expected Auxiliary Space: O(1).
Constraints:
|S| = 2
S_{i} = R/S/P

Difficulty: EASY
Tags: String algorithms

Data structures
Skill types: Data structures
Expected Time Complexity: O(1).
Expected Auxiliary Space: O(1).

Starter code:
#User function Template for python3

class Solution:
    def gameResult(self, s):
        # code here

Solutions:
class Solution:

	def gameResult(self, s):
		for i in range(len(s)):
			if s[i] == 'R' and s[i + 1] == 'S':
				return 'A'
			elif s[i] == 'S' and s[i + 1] == 'R':
				return 'B'
			elif s[i] == 'R' and s[i + 1] == 'P':
				return 'B'
			elif s[i] == 'P' and s[i + 1] == 'R':
				return 'A'
			elif s[i] == 'S' and s[i + 1] == 'P':
				return 'A'
			elif s[i] == 'P' and s[i + 1] == 'S':
				return 'B'
			else:
				return 'DRAW'


class Solution:

	def gameResult(self, s):
		if s[0] == s[1]:
			return 'DRAW'
		elif s in ('RS', 'SP', 'PR'):
			return 'A'
		else:
			return 'B'


class Solution:

	def gameResult(self, s):
		k = list(map(str, str(s)))
		if k[0] == k[1]:
			return 'DRAW'
		elif k[0] == 'R' and k[1] == 'S' or (k[0] == 'S' and k[1] == 'P') or (k[0] == 'P' and k[1] == 'R'):
			return 'A'
		else:
			return 'B'


class Solution:

	def gameResult(self, s):
		if s[0] == 'R' and s[1] == 'R':
			return 'DRAW'
		elif s[0] == 'R' and s[1] == 'S':
			return 'A'
		elif s[0] == 'S' and s[1] == 'P':
			return 'A'
		elif s[0] == 'P' and s[1] == 'R':
			return 'A'
		elif s[0] == 'P' and s[1] == 'P':
			return 'DRAW'
		elif s[0] == 'S' and s[1] == 'S':
			return 'DRAW'
		else:
			return 'B'


class Solution:

	def gameResult(self, s):
		if ''.join(s) in ['PR', 'RS', 'SP']:
			return 'A'
		elif ''.join(s) in ['PS', 'RP', 'SR']:
			return 'B'
		else:
			return 'DRAW'


class Solution:

	def gameResult(self, s):
		if s == 'RR' or s == 'PP' or s == 'SS':
			return 'DRAW'
		if s == 'RS' or s == 'SP' or s == 'PR':
			return 'A'
		else:
			return 'B'


class Solution:

	def gameResult(self, s):
		(a, b, c) = ('RS', 'SP', 'PR')
		if s[0] == s[1]:
			return 'DRAW'
		elif s == a or s == b or s == c:
			return 'A'
		else:
			return 'B'


class Solution:

	def gameResult(self, s):
		if s == 'RR' or s == 'SS' or s == 'PP':
			return 'DRAW'
		elif s == 'RP':
			return 'B'
		elif s == 'PR':
			return 'A'
		elif s == 'RS':
			return 'A'
		elif s == 'SR':
			return 'B'
		elif s == 'PS':
			return 'B'
		else:
			return 'A'


class Solution:

	def gameResult(self, s):
		res = ''
		if s == 'RR' or s == 'PP' or s == 'SS':
			res += 'DRAW'
		elif s[0] == 'R' and s[1] == 'S':
			res += 'A'
		elif s[0] == 'S' and s[1] == 'P':
			res += 'A'
		elif s[0] == 'P' and s[1] == 'R':
			res += 'A'
		elif s[0] == 'S' and s[1] == 'R':
			res += 'B'
		elif s[0] == 'P' and s[1] == 'S':
			res += 'B'
		else:
			res += 'B'
		return res


class Solution:

	def gameResult(self, s):
		if s.count('R') == len(s) or s.count('S') == 2 or s.count('P') == 2:
			return 'DRAW'
		elif s.count('R') == 1 and s.count('S') and (s[0] == 'R'):
			return 'A'
		elif s.count('S') == 1 and s.count('R') == 1 and (s[0] == 'S'):
			return 'B'
		elif s.count('P') == 1 and s.count('S') == 1 and (s[0] == 'P'):
			return 'B'
		elif s.count('S') == 1 and s.count('P') == 1 and (s[0] == 'S'):
			return 'A'
		elif s.count('R') == 1 and s.count('P') == 1 and (s[0] == 'R'):
			return 'B'
		elif s.count('P') == 1 and s.count('R') and (s[0] == 'P'):
			return 'A'
		return 'A'


class Solution:

	def gameResult(self, s):
		if s[0] == s[1]:
			return 'DRAW'
		if s == 'RS' or s == 'SP' or s == 'PR':
			return 'A'
		return 'B'


class Solution:

	def gameResult(self, s):
		f = s[0]
		s = s[1]
		if f == 'R' and s == 'R' or (f == 'S' and s == 'S') or (f == 'P' and s == 'P'):
			return 'DRAW'
		if f == 'R':
			if s == 'S':
				return 'A'
			if s == 'P':
				return 'B'
		if f == 'P':
			if s == 'R':
				return 'A'
			if s == 'S':
				return 'B'
		if f == 'S':
			if s == 'R':
				return 'B'
			if s == 'P':
				return 'A'


class Solution:

	def gameResult(self, s):
		if s[0] == s[1]:
			return 'DRAW'
		elif s == 'RP':
			return 'B'
		elif s == 'SR':
			return 'B'
		elif s == 'PS':
			return 'B'
		elif s == 'RS':
			return 'A'
		elif s == 'SP':
			return 'A'
		else:
			return 'A'


class Solution:

	def gameResult(self, s):
		d = {'RR': 'DRAW', 'SS': 'DRAW', 'PP': 'DRAW', 'RS': 'A', 'SP': 'A', 'PR': 'A', 'SR': 'B', 'PS': 'B', 'RP': 'B'}
		return d[s]


class Solution:

	def gameResult(self, s):
		m = list(s)
		if m[0] == m[1]:
			return 'DRAW'
		elif m[0] == 'R':
			if m[1] == 'S':
				return 'A'
			return 'B'
		elif m[0] == 'P':
			if m[1] == 'R':
				return 'A'
			return 'B'
		elif m[0] == 'S':
			if m[1] == 'P':
				return 'A'
			return 'B'


class Solution:

	def gameResult(self, s):
		a1 = 'RS'
		a2 = 'SR'
		a3 = 'RP'
		a4 = 'PR'
		a5 = 'PS'
		a6 = 'SP'
		A = 'A'
		B = 'B'
		if s == s[::-1]:
			return 'DRAW'
		elif s == a1:
			return A
		elif s == a2:
			return B
		elif s == a3:
			return B
		elif s == a4:
			return A
		elif s == a5:
			return B
		elif s == a5:
			return A
		else:
			return A


class Solution:

	def gameResult(self, s):
		a = b = 0
		for i in range(0, len(s), 2):
			x = s[i:i + 2]
			if x == 'RS' or x == 'SP' or x == 'PR':
				a += 1
			elif x == 'RR' or x == 'PP' or x == 'SS':
				pass
			else:
				b += 1
		if a == b:
			return 'DRAW'
		elif a > b:
			return 'A'
		else:
			return 'B'


class Solution:

	def gameResult(self, s):
		a = b = 0
		for i in range(0, len(s), 2):
			if s[i] == s[i + 1]:
				a += 1
				b += 1
			elif s[i] == 'R' and s[i + 1] == 'S' or (s[i] == 'P' and s[i + 1] == 'R') or (s[i] == 'S' and s[i + 1] == 'P'):
				a += 1
			else:
				b += 1
		if a == b:
			return 'DRAW'
		elif a > b:
			return 'A'
		else:
			return 'B'


class Solution:

	def gameResult(self, s):
		t = ''
		for i in s:
			t += i
		t = set(t)
		if s == 'RS' or s == 'SP' or s == 'PR':
			return 'A'
		elif len(t) == 1:
			return 'DRAW'
		else:
			return 'B'


class Solution:

	def gameResult(self, s):
		(A, B) = s
		if A == B:
			return 'DRAW'
		elif A == 'S' and B == 'P':
			return 'A'
		elif A == 'P' and B == 'S':
			return 'B'
		elif s == ''.join(sorted(s)):
			return 'A'
		else:
			return 'B'