Design the function to input a string and output 'true' or 'false' - telling whether or not the string is an expression.
Print a message telling whether the string is a well-formed expression. Finally, after processing all the input, the program prints an exit message and stops. The following rule defines a well-formed expression:
.expr> = S | I(C)T(.exp>)
Here is my code:
import java.io.FileNotFoundException;
import java.util.*;
import java.util.Scanner;
public class RecursionExpression {
    public static void main(String[] args) throws FileNotFoundException{
        System.out.println("Enter the expression statement.");
        Scanner keyboard = new Scanner(System.in);
        String expr = keyboard.nextLine();
    }
    public static boolean expression(String n)
    {
        if (n.charAt(0) == 's')
        return true;
        else if(n.length() >=6)
        {
            if (n.substring(0,5) == "I(C)T")
                return expression(n.substring(6, n.length()-1));
        }
        return false;
    }
}
 
     
    