Through the profile, we can see that the most cost of the runtime is 'grep()' and 'convert_char_to_string()' functions. As file size growing up, which means more characters in file, the runtime of 'grep()' grows much more faster than the other functions. So we are going to work on 'grep()' function.<br>
Let's going through grep() function:
```
int grep(std::string keyword, std::string input)
{
int counter = 0;
//cout << input << endl;
int keywordLen = keyword.length();
int inputLen = input.length();
char* temp;
temp = new char(keywordLen);
for (int i = 0; i < (inputLen - keywordLen); i++) {
for (int j = 0; j<keywordLen; j++) {
temp[j] = input[i + j];
}
temp[keywordLen] = '\0';
//cout << temp << endl;
if (temp == keyword) {
counter++;
}
}
return counter;
}
```
=== Assignment 3 ===