input: Write a python function to perform linear regression on stock prices and plot the results using matplotlib.
  assert len(linear_regression_stock_prices([10, 20, 30, 40, 50])) == 2  # Check if the function returns two values (model and y_pred)
  assert isinstance(linear_regression_stock_prices([10, 20, 30, 40, 50])[0], LinearRegression)  # Check if the first returned value is a LinearRegression object
  assert len(linear_regression_stock_prices([10, 20, 30, 40, 50])[1]) == 5  # Check if the second returned value (predictions) matches the input length
output: import numpy as np
  import matplotlib.pyplot as plt
  from sklearn.linear_model import LinearRegression
  
  def linear_regression_stock_prices(prices):
      # Prepare the data
      X = np.array(range(len(prices))).reshape(-1, 1)
      y = np.array(prices)
      
      # Create the model and fit it
      model = LinearRegression()
      model.fit(X, y)
      
      # Predict the stock prices
      y_pred = model.predict(X)
      
      # Plot the results
      plt.scatter(X, y, color='blue', label='Actual Prices')
      plt.plot(X, y_pred, color='red', label='Predicted Prices')
      plt.xlabel('Time')
      plt.ylabel('Stock Price')
      plt.title('Linear Regression on Stock Prices')
      plt.legend()
      plt.show()
      
      return model, y_pred