Given two integers a and b. Write a program to find the number of digits in the product of these two integers.
Example 1:
Input: a = 12, b = 4
Output: 2 
Explanation: 12*4 = 48
Hence its a 2 digit number.
Example 2:
Input: a = -24, b = 33
Output: 3
Explanation: -24*33 = -792
Hence its a 3 digit number.
Your Task:  
You dont need to read input or print anything. Complete the function countDigits() which takes a and b as input parameter and returns the number of digits in the product of the two numbers.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
-10^{8}<= a,b <=10^{8}

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3
class Solution:
    def countDigits (self, a, b):
        # code here 

Solutions:
class Solution:

	def countDigits(self, a, b):
		s = a * b
		s = abs(s)
		return len(str(s))


class Solution:

	def countDigits(self, a, b):
		c = a * b
		return len(str(abs(c)))


class Solution:

	def countDigits(self, a, b):
		c = a * b
		if c < 0:
			c *= -1
		return len(str(c))


class Solution:

	def countDigits(self, a, b):
		count = 0
		p = a * b
		p = abs(p)
		while p > 0:
			last = p % 10
			count += 1
			p = p // 10
		return count


class Solution:

	def countDigits(self, a, b):
		return len(str(int(abs(a * b))))


class Solution:

	def countDigits(self, a, b):
		sum = abs(a * b)
		return len(str(sum))


class Solution:

	def countDigits(self, a, b):
		m = abs(a * b)
		return len(str(m))


class Solution:

	def countDigits(self, a, b):
		p = abs(a) * abs(b)
		c = 0
		while p:
			r = p % 10
			c += 1
			p = p // 10
		return c


class Solution:

	def countDigits(self, a, b):
		s = a * b
		if s < 0:
			s = s * -1
		s = str(s)
		k = len(s)
		return k


import math

class Solution:

	def countDigits(self, a, b):
		c = a * b
		d = abs(c)
		return int(math.log10(d) + 1)


class Solution:

	def countDigits(self, a, b):
		if a > 0 and b > 0 or (a < 0 and b < 0):
			return len(str(a * b))
		else:
			return len(str(a * b)) - 1


class Solution:

	def countDigits(self, a, b):
		x = abs(a * b)
		y = str(x)
		return len(y)


class Solution:

	def countDigits(self, a, b):
		x = a * b
		if x > 0:
			y = str(x)
			return len(y)
		else:
			y = str(x)
			return len(y) - 1


class Solution:

	def countDigits(self, a, b):
		p = str(a * b)
		p = p.replace('-', '')
		l = list(str(p))
		return len(l)


class Solution:

	def countDigits(self, a, b):
		x = a * b
		y = list(str(x))
		if y[0:1] == ['-']:
			y.remove('-')
		return len(y)


class Solution:

	def countDigits(self, a, b):
		n = a * b
		if n < 1:
			n = n * -1
		return len(list(str(n)))


class Solution:

	def countDigits(self, a, b):
		ans = abs(a * b)
		res = str(ans)
		return len(res)


class Solution:

	def countDigits(self, a, b):
		return len(str(a * b).replace('-', ''))


class Solution:

	def countDigits(self, a, b):
		li = []
		c = abs(a * b)
		while c > 0:
			d = c % 10
			c = c // 10
			li.append(d)
		return len(li)


class Solution:

	def countDigits(self, a, b):
		c = a * b
		d = list(str(c))
		if abs(c) == c:
			return len(d)
		else:
			return len(d) - 1


class Solution:

	def countDigits(self, a, b):
		x = a * b
		y = str(x)
		count = 0
		for i in y:
			if i.isdigit():
				count += 1
		return count


import math

class Solution:

	def countDigits(self, a, b):
		p = abs(a * b)
		return int(math.log10(p)) + 1


class Solution:

	def countDigits(self, a, b):
		mul = abs(a * b)
		mul = str(mul)
		return len(mul)


from math import *

class Solution:

	def countDigits(self, a, b):
		if a < 0:
			a = a * -1
		if b < 0:
			b = b * -1
		return int(log10(a * b) + 1)


class Solution:

	def countDigits(self, a, b):
		z = abs(a * b)
		return len(str(z))


class Solution:

	def countDigits(self, a, b):
		n = a * b
		c = 0
		n = abs(n)
		while n > 0:
			c = c + 1
			n = n // 10
		return c


import math

class Solution:

	def countDigits(self, a, b):
		c = a * b
		if c < 0:
			c = c * -1
		return math.floor(math.log10(c) + 1)


class Solution:

	def countDigits(self, a, b):
		multi = a * b
		abs_multi = abs(multi)
		digit = len(str(abs_multi))
		return digit


class Solution:

	def countDigits(self, a, b):
		prod = a * b
		return len(str(abs(prod)))


class Solution:

	def countDigits(self, a, b):
		X = abs(a * b)
		X = str(X)
		X = list(X)
		return len(X)


class Solution:

	def countDigits(self, a, b):
		x = a * b
		if x < 0:
			x = x - 2 * x
		return len(str(x))


class Solution:

	def countDigits(self, a, b):
		ans = a * b
		if str(ans).startswith('-'):
			return len(str(a * b)) - 1
		return len(str(a * b))


import math

class Solution:

	def countDigits(self, a, b):
		product = abs(a * b)
		return len(str(product))


import math

class Solution:

	def countDigits(self, a, b):
		n = str('{:.0f}'.format(math.fabs(a * b)))
		return len(n)


from math import log10, floor

class Solution:

	def countDigits(self, a, b):
		if 0 in (a, b):
			return 1
		return floor(log10(abs(a * b)) + 1)


class Solution:

	def countDigits(self, a, b):
		count = 0
		mul = str(a * b)
		for digit in mul:
			count += 1
		if int(mul) < 0:
			return count - 1
		return count


class Solution:

	def countDigits(self, a, b):
		product = a * b
		string = str(product)
		negative_symbol_exist = '-' in string
		num_of_digits = 0
		if negative_symbol_exist:
			num_of_digits -= 1
		for i in string:
			num_of_digits += 1
		return num_of_digits


class Solution:

	def countDigits(self, a, b):
		s = a * b
		c = 0
		s = abs(s)
		while s > 0:
			rem = s % 10
			c += 1
			s = s // 10
		return c


class Solution:

	def countDigits(self, a, b):
		s = a * b
		if s > 0:
			return len(str(s))
		else:
			s1 = s * -1
			return len(str(s1))


class Solution:

	def countDigits(self, a, b):
		product = a * b
		s = str(product)
		if '-' in s:
			return len(s[1:])
		else:
			return len(s)


class Solution:

	def countDigits(self, a, b):
		n = abs(a * b)
		return len(str(n))


class Solution:

	def countDigits(self, a, b):
		count = 0
		mul = a * b
		for i in str(mul):
			count += 1
		if mul > 0:
			return count
		else:
			return count - 1


class Solution:

	def countDigits(self, a, b):
		r = a * b
		return len(str(abs(r)))


class Solution:

	def countDigits(self, a, b):
		p = a * b
		l = list(str(p))
		c = 0
		for i in l:
			if i != '-':
				c = c + 1
		return c


class Solution:

	def countDigits(self, a, b):
		p = abs(a * b)
		val = str(p)
		ans = len(val)
		return ans


class Solution:

	def countDigits(self, a, b):
		ans = a * b
		res = str(ans)
		if res[0] == '-':
			return len(res) - 1
		else:
			return len(res)


class Solution:

	def countDigits(self, a, b):
		product = a * b
		if product < 0:
			return len(str(product)) - 1
		else:
			return len(str(product))


class Solution:

	def countDigits(self, a, b):
		c = a * b
		c1 = str(c)
		arr = []
		for i in range(len(c1)):
			arr.append(c1[i])
		if '-' in arr:
			arr.remove('-')
		return len(arr)


class Solution:

	def countDigits(self, a, b):
		cal = abs(a * b)
		cal = str(cal)
		return len(cal)


class Solution:

	def countDigits(self, a, b):
		c = a * b
		s = str(c)
		l = list(s)
		if '-' in l:
			return len(l) - 1
		else:
			return len(l)