Write Java or C code to implement a FSM machine that recognizesthe language
for the alphabet {a,b,c} consisting of all strings that containtwo consecutive
c’s and end with b.
Your FSM program should include the following three staticmethods (Java) or functions (C):
a. int nextState(int state, char symbol)
A state-transition function that returns the next state based onthe current state and an input symbol. This function should alsoreturn -1 when an invalid input character is detected.
State transition behavior can be stored in a 2-dimensional arraywhere the first dimension represents the current state and thesecond dimension represents the next input character. The entriesfor the array are
OR
OR