Hint: You are looking for substrings within a string.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
Why don't u use nice standard functions...
import java.util.*;
import java.io.*;
public class Main
{
public static void main(String args[])
{
String sentence = "hello there";//change it here
String ac = ">>>ACCEPTED";
String[] temp = null;
temp = sentence.split(" ");
// split sentence into tokens using the space as
// a divider
for (int j = 0; j < temp.length; j++ )
{
if (temp[j].equals("bridge"))
{
ac = ">>>>rejected";
}
else if (temp[j].equals("River"))
{
ac = ">>>>rejected";
}
}
System.out.println(sentence + " " + ac);
}
}
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439