So I want to take certain parts of inputs and make them variables. So for example, and input that would go in is '3x^2+4x+6' and I would want the code to take the 3, the 4, and the 6 out of that string. Is there a way I can do this efficiently, as when I make the [1] anything bigger, there is an exception, and when it is [1] or below nothing writes. I just need something simple that takes those specific numbers out at those positions. The 3x^2 could just be an x^2 with no number and the 4x could be just an x. I want to take a '1' in that case. Please let me know if I need to include any more details. That is all the code I currently have in the project.
namespace Factoring_Calculator
{
class Program
{
static void Main(string[] args)
{
Console.Write("Input the equation you want factored(no spaces): ");
string equation = Console.ReadLine();
Console.Write(equation);
string a = equation.Split("x")[1];
Console.Write(a);
Console.Read();
}
}
}