- > ---> a | b ---> 1 | 1
它假设从a或b开始,然后是1.a或b之后有多少1并不重要.例如:a1,b1,b111111,a111我输入的所有内容都无效但这应该是有效的:a1,b1,b111111,a111
/*
<S> --> <A><B>
<A> ---> a | b
<B> ---> 1 | 1 <B>
It suppose to be vaild for example: a1, b1, b111111, a111
*/
#include <iostream>
#include<stdlib.h> // for the exit(1) function
using namespace std;
char text[100];
char ToBeChecked;
char lexical(); //identify the characters
void SProd();
void AProd();
void BProd();
int main()
{
cout<<"Enter a string(max. 100 characters"<<endl;
cin>>text;
ToBeChecked = lexical(); //identify the character; find …Run Code Online (Sandbox Code Playgroud)