Untitled
unknown
python
2 years ago
813 B
12
Indexable
def calculate_value(s):
# If there are digits in the string, concatenate them and convert to an integer.
digits = ''.join(filter(str.isdigit, s))
if digits:
return int(digits)
# If there are no digits, return the length of the string.
return len(s)
def max_product_of_values(arr):
n = len(arr)
max_product = 0
# Iterate through the array to calculate values and find the maximum product.
for i in range(n):
for j in range(i + 1, n):
product = calculate_value(arr[i]) * calculate_value(arr[j])
max_product = max(max_product, product)
return max_product
# Input
n = int(input())
arr = input().split()
# Calculate and print the maximum product of values
result = max_product_of_values(arr)
print(result)
Editor is loading...