Get the String:
String equation = user input;

Separate the string into a String list(array? arrayList?) of components.

example
equation = x^7+13x^4-22

your string array looks like
string1...