Professional Documents
Culture Documents
Theory:
The three main components of a regular expression are anchors that are used to
specify the position of a pattern in relation to a line of text, character sets that
match one or more characters in a single position, and modifiers that specify the
number of times the previous character set is repeated.
2nd program:
#include <bits/stdc++.h>
using namespace std;
if(s[i]=='c')
q2(s,i+1);
else
cout<<"Invalid String";
return;
}
if(s[i]=='a' || s[i]=='b')
{
q1(s,i+1);
}
if(s[i]=='c' || s[i]=='d')
{
q2(s,i+1);
}
}
if(s[i]=='a')
{
q1(s,i+1);
}
}
int main()
{
string s;
cout<<"Enter the string: ";
cin>>s;
q0(s,0);
}
OUTPUT: