How can I reduce the amount of memory that my program takes up after compilation?
#include <iostream> #include<string> using namespace std; void printpatt(string a, int i); int main() { int i = 0; string a = ""; while (getline(cin, a)) { printpatt(a, i); i = 0; } return 0; } void printpatt(string a, int i) { string temp = ""; while (a[i] != '\0') { if (a[i] == 'a' && a[i + 1] == 'b' && (a[i + 2] == 'b' || a[i + 2] == 'c')) { temp += a[i]; temp += a[i + 1]; i += 2; } else if (a[i] == 'b' && a[i - 1] == 'b' && a[i - 2] != 'c' && (a[i - 2] == 'a' || a[i - 2] == 'b') && (a[i + 1] == 'b' || a[i + 1] == 'c')) { temp += a[i]; i++; } else if (a[i] == 'c' && a[i - 1] == 'b' && (a[i - 2] == 'a' || a[i - 2] == 'b') && a[i - 3] != 'c') { temp += a[i]; if (temp.length() > 2 && temp[0] == 'a' && temp[temp.length() - 1] == 'c') { cout << temp << endl; temp = ""; i++; } } else { temp = ""; i++; } } }