It's my part of java program for project.
String ops="";
String input="1+3-4+(7/8)+cos(sin(50)+2)/2+tan(90)*e^(5+26-4/1*2)";
input=input.replaceAll("cos", "c").replaceAll("sin", "s").replaceAll("tan", "t").replace("e", "2.718");
//System.out.println(input);
Pattern pattern=Pattern.compile("[+-/*()cst^]");
Matcher matcher= pattern.matcher(input);
while (matcher.find()) {ops+=matcher.group();}
System.out.println(ops);
Here I am just reading the input and giving output of +,-,/,*,(,),c,s & t present in it. The output ops
should return +-+(/)+c(s()+)/+t()*^(+-/*)
while it's returning +-+(/)+c(s()+)/+t()*.^(+-/*)
.Help me understand the reason please.