A string tokenizer will separate that long string in an array of small strings.
I.e.
If you had the string "My@Name@Is@bobby@!" (that's not my name btw ;) ) and you set up a string tokenizer to deliminate by @ you'd end up with an array of 5 elements.
"My","Name","is","bobby","!"
Then you could loop through the array trying to match certain cases.
import java.util.*;
public class TokenizerTest{
public static void main(String[] args){
String input = "step(sent(1,A,B,vars(Na,Rv,ped(pk(B),cat(Na,A)))))"
String output = null;
StringTokenizer st = new StringTokenizer(input,")");
while(st.hasMoreTokens()){
if(st.nextToken().equals("some string")){
// do stuff here
}
}
System.out.println("Output: "+ output);
}
} I'm not sure how the input relates to the output so you can figure that out. But atleast you should know how now. After you tokenize by ")" you'll be left with 8 tokens:
"step"
"sent"
"1,A,B,vars"
"Na,Rv,ped"
"Pk"
"B"
",cat"
"Na,A"
If you want you could deliminate even further by "," but that's up to you.