a, b = map(int, input("Enter two numbers separated by a space: ").split())
x, y = (a, b) if a > b else (b, a)
hcf = max(i for i in range(1, x) if a % i == 0 and b % i == 0)
lcm = min(j for j in range(x, a * b) if j % a == 0 and j % b == 0)
print("HCF:", hcf)
print("LCM:", lcm)
In this, the map() function is used to convert the input numbers to integers. The variables x and y are assigned using a conditional expression. The max() function is used with a generator expression to find the highest common factor (HCF), and the min() function with a generator expression is used to find the least common multiple (LCM). Finally, the print statements display the results.