Untitled
unknown
plain_text
a year ago
458 B
2
Indexable
Never
#include <iostream> #include <string> using namespace std; bool isLeftRecursive(string s) { if (s[0] == s[3]) { return true; } return false; } int main() { string s; cout << "Enter a grammar: "; cin >> s; if (isLeftRecursive(s)) { cout << s << " is a left recursive grammar." << endl; } else { cout << s << " is not a left recursive grammar." << endl; } return 0; }