You are given a string S. Your task is to determine if the sum of ASCII values of all character results in a perfect square or not. If it is a perfect square then the answer is 1, otherwise 0.
Example 1:
Input: S = "d"
Output: 1
Explanation: Sum of ASCII of S is 100 
which is a square number.
Ã¢â¬â¹Example 2:
Input: S = "1Qy"
Output: 0
Explanation: Sum of ASCII of S is
251 which is not a square.
Your Task:  
You don't need to read input or print anything. Your task is to complete the function isSquare() which takes the string S as inputs and returns the answer.
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ |S| ≤ 10^{5}

Difficulty: EASY
Tags: String algorithms

Data structures

Mathematics
Skill types: Data structures
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3



class Solution:

    def isSquare(self, S): 

        #code here







Solutions:
class Solution:

	def isSquare(self, S):
		asc = 0
		for i in S:
			asc += ord(i)
		return 1 if asc ** 0.5 % 2 == 0 else 0


class Solution:

	def isSquare(self, S):
		val = 0
		for i in S:
			val += ord(i)
		import math
		intt = int(math.sqrt(val))
		floatt = math.sqrt(val)
		if intt % floatt == 0:
			return 1
		return 0


import math

class Solution:

	def isSquare(self, S):
		s = 0
		for i in S:
			s += ord(i)
		root = str(math.sqrt(s)).split('.')
		if root[1] == '0':
			return 1
		else:
			return 0


class Solution:

	def isSquare(self, S):
		s = 0
		for i in S:
			s += ord(i)
		i = 1
		while i * i <= s:
			if i * i == s:
				return 1
			i += 1
		return 0


import math

class Solution:

	def isSquare(self, S):
		s = 0
		for i in S:
			if i.isalpha() == True:
				s += ord(i)
		if math.ceil(math.sqrt(s)) == math.floor(math.sqrt(s)):
			return 1
		else:
			return 0


class Solution:

	def isSquare(self, S):
		import math
		s = 0
		for i in S:
			s += ord(i)
		return 1 if math.sqrt(s) % 2 == 0 else 0


class Solution:

	def isSquare(self, S):
		ans = 0
		for i in S:
			ans += ord(i)
		if ans ** (1 / 2) == int(ans ** (1 / 2)):
			return 1
		return 0


import math

class Solution:

	def isSquare(self, S):
		result = 0
		for i in S:
			val = ord(i)
			result += val
		root = int(math.sqrt(result))
		if root * root == result:
			return 1
		else:
			return 0


import math

class Solution:

	def checkPerfectSquare(N):
		sq = int(math.sqrt(N))
		if sq * sq == N:
			return 1
		return 0

	def isSquare(self, S):
		sumS = 0
		for i in range(len(S)):
			sumS += ord(S[i])
		return Solution.checkPerfectSquare(sumS)


import math

class Solution:

	def isSquare(self, S):
		string = 0
		for index in S:
			string += ord(index)
		return 1 if math.sqrt(string) % 2 == 0 else 0


import math

class Solution:

	def isSquare(self, S):
		sum = 0
		for i in range(len(S)):
			sum += ord(S[i])
		if math.floor(math.sqrt(sum)) * math.floor(math.sqrt(sum)) == sum:
			return 1
		else:
			return 0


class Solution:

	def isSquare(self, S):
		a = 0
		for i in S:
			a += ord(i)
		if int(a ** 0.5) * int(a ** 0.5) == a:
			return 1
		return 0


import math as m

class Solution:

	def isSquare(self, S):
		a = 0
		for i in S:
			a += ord(i)
		if int(m.sqrt(a)) ** 2 == a:
			return 1
		return 0


from math import sqrt as sr, ceil as c, floor as f

class Solution:

	def isSquare(self, S):

		def sqrts(n):
			if c(sr(n)) == f(sr(n)):
				return True
			return False
		s = 0
		for i in S:
			s += ord(i)
		if sqrts(s):
			return 1
		else:
			return 0


import math

class Solution:

	def isSquare(self, s):
		summ = 0
		for i in s:
			summ += ord(i)
		n = int(math.sqrt(summ))
		if n * n == summ:
			return 1
		return 0


from math import sqrt

class Solution:

	def isSquare(self, S):
		s = 0
		for i in S:
			if i.isalpha():
				s += ord(i)
		sq_root = int(sqrt(s))
		if sq_root * sq_root == int(s):
			return 1
		else:
			return 0


import math

class Solution:

	def isSquare(self, S):
		res = 0
		for i in S:
			res += ord(i)
		s = int(math.sqrt(res))
		if s * s == res:
			return 1
		return 0


class Solution:

	def isSquare(self, S):
		h = 0
		for i in S:
			h += ord(i)
		v = h ** (1 / 2)
		if int(v) ** 2 == h:
			return 1
		return 0


from math import sqrt, pow

class Solution:

	def isSquare(self, S):
		res = 0
		for e in S:
			res += ord(e)
		n = int(sqrt(res))
		if pow(n, 2) == res:
			return 1
		return 0


import math

class Solution:

	def isSquare(self, S):
		a = 0
		for i in range(len(S)):
			a += ord(S[i])
		b = math.sqrt(a)
		if b % 2 == 0:
			return 1
		else:
			return 0


from math import ceil

class Solution:

	def isSquare(self, S):
		s = 0
		for i in S:
			s += ord(i)
		if int(s ** 0.5) == ceil(s ** 0.5):
			return 1
		return 0


import math

class Solution:

	def isSquare(self, s):
		sm = 0
		for i in s:
			sm += ord(i)
		sr = int(math.sqrt(sm))
		return int(sr * sr == sm)


class Solution:

	def isSquare(self, S):
		num = sum([ord(item) for item in S]) ** 0.5
		return int(num == int(num))


class Solution:

	def isSquare(self, S):
		res = 0
		for x in S:
			res += ord(x)
		sq = res ** 0.5
		return 1 if sq == int(sq) else 0


import math

class Solution:

	def isSquare(self, S):

		def isPerfectSquare(ans):
			return math.sqrt(ans) - math.floor(math.sqrt(ans)) == 0
		ans = 0
		for i in S:
			ans += ord(i)
		if isPerfectSquare(ans):
			return 1
		else:
			return 0


class Solution:

	def isSquare(self, S):
		c = 0
		for i in S:
			c += ord(i)
		start = 1
		end = c
		while start <= end:
			mid = (start + end) // 2
			if mid * mid == c:
				return 1
			elif mid * mid > c:
				end = mid - 1
			else:
				start = mid + 1
		return 0


class Solution:

	def isSquare(self, S):
		import math
		S = list(S)
		add = 0
		ans = 0
		for i in range(0, len(S)):
			add += ord(S[i])
		if int(math.sqrt(add)) == math.sqrt(add):
			ans = 1
		return ans


class Solution:

	def isSquare(self, S):
		s = 0
		for a in S:
			m = ord(a)
			s += m
		ans = int(s ** 0.5)
		if ans * ans == s:
			return 1
		else:
			return 0


import math

class Solution:

	def isSquare(self, S):
		sum = 0
		for i in S:
			sum += ord(i)
		lis = list(range(1, sum // 2))
		if math.sqrt(sum) in lis:
			return 1
		else:
			return 0


class Solution:

	def isSquare(self, S):
		sum = 0
		for a in S:
			sum += ord(a)
		num = sum ** 0.5
		if num == int(sum ** 0.5):
			return 1
		return 0


import math

class Solution:

	def isSquare(self, S):
		ascii_sum = sum([ord(i) for i in S])
		sr = int(math.sqrt(ascii_sum))
		return 1 if sr * sr == ascii_sum else 0


class Solution:

	def isSquare(self, S: str) -> int:
		summation = 0
		for x in S:
			summation += ord(x)
		if self.isPerfectSquare(summation):
			return 1
		else:
			return 0

	@staticmethod
	def isPerfectSquare(num: int) -> bool:
		x = int(num ** 0.5)
		return x ** 2 == num


from math import sqrt

class Solution:

	def isSquare(self, S):
		num = 0
		for i in S:
			num += ord(i)
		if self.helper(num) == True:
			return 1
		return 0

	def helper(self, N):
		for i in range(1, int(sqrt(N)) + 1):
			if i * i == N:
				return True
		return False


class Solution:

	def isSquare(self, S):
		asc = 0
		for i in S:
			asc += ord(i)
		x = asc ** 0.5
		if str(x)[-1] != '0':
			return 0
		return 1


import math

class Solution:

	def isSquare(self, S):
		n = 0
		for i in S:
			n += ord(i)
		root = math.sqrt(n)
		if int(root + 0.5) ** 2 == n:
			return 1
		return 0


class Solution:

	def isSquare(self, S):
		sum = 0
		for i in S:
			sum += ord(i)
		x = sum ** 0.5
		if int(x) == x:
			return 1
		else:
			return 0


class Solution:

	def isSquare(self, S):
		import math as g
		k = x = 0
		for i in S:
			k += ord(i)
		for i in range(int(g.sqrt(k)) + 1):
			if pow(i, 2) == k:
				return 1
		return 0


class Solution:

	def isSquare(self, S):
		sum = 0
		for i in S:
			sum += ord(i)
		for i in range(sum // 2):
			if i * i == sum:
				return 1
		else:
			return 0


class Solution:

	def isSquare(self, S):
		l = n = 0
		for i in S:
			l += ord(i)
		n = l ** 0.5
		if n % 1 == 0:
			n = int(n)
		else:
			n = n
		if type(n) == float:
			return 0
		return 1


class Solution:

	def isSquare(self, S):
		l = n = 0
		for i in S:
			l += ord(i)
		if l ** 0.5 % 2 == 0:
			return 1
		return 0


class Solution:

	def isSquare(self, s):
		t = 0
		for i in s:
			t += ord(i)
		if t ** (1 / 2) == int(t ** (1 / 2)):
			return 1
		return 0


from math import sqrt

class Solution:

	def isSquare(self, S):
		b = 0
		for i in S:
			b += ord(i)
		if sqrt(b) % 1 == 0:
			return 1
		return 0


import math

class Solution:

	def isSquare(self, S):
		sum = 0
		for c in S:
			sum += ord(c)
		per_sqrt = int(math.sqrt(sum))
		if per_sqrt * per_sqrt == sum:
			return 1
		else:
			return 0


import math

class Solution:

	def isSquare(self, S):
		a = 0
		for i in S:
			a += ord(i)
		r = math.sqrt(a)
		if int(r + 0.5) ** 2 == a:
			return 1
		return 0


import math

class Solution:

	def isSquare(self, S):
		s = 0
		n = len(S)
		for i in range(n):
			s += ord(S[i])
		x = math.sqrt(s)
		if x - int(x) == 0:
			return 1
		return 0


import math

class Solution:

	def isSquare(self, S):
		a = 0
		for i in S:
			a += ord(i)
		c = int(math.sqrt(a))
		if c * c == a:
			return 1
		else:
			return 0


import math

class Solution:

	def isSquare(self, S):
		sums = 0
		for i in S:
			sums = sums + ord(i)
		y = math.sqrt(sums)
		if y.is_integer():
			return 1
		return 0


class Solution:

	def isSquare(self, S):
		num = 0
		for i in S:
			num += ord(i)
		num = num ** 0.5
		return 1 if int(num) == float(num) else 0


import math

class Solution:

	def isSquare(self, S):
		s = 0
		for i in range(len(S)):
			s = s + ord(S[i])
		i = 0
		k = math.sqrt(s)
		while i <= k:
			if i * i == s:
				return 1
			i = i + 1
		return 0


from math import sqrt

class Solution:

	def isSquare(self, S):
		n = 0
		for i in S:
			a = ord(i)
			n += a
		s = sqrt(n)
		r = n % sqrt(n)
		if r == 0:
			return 1
		else:
			return 0


import math

class Solution:

	def isSquare(self, s):
		a = 0
		for i in s:
			a += ord(i)
		if math.floor(math.sqrt(a)) == math.ceil(math.sqrt(a)):
			return 1
		return 0


from math import *

class Solution:

	def isSquare(self, S):
		a = 0
		for i in S:
			a += ord(i)
		if floor(sqrt(a)) == ceil(sqrt(a)):
			return 1
		else:
			return 0


from math import floor, ceil

class Solution:

	def isSquare(self, S):
		n = sum([ord(i) for i in S])
		return int(floor(n ** 0.5) == ceil(n ** 0.5))