#include <iostream>
#include <string>
#include <vector>
#include <fstream>
using namespace std;
int main() {
int count = 0;
vector<string> file;
// Create the ifstream object and open a file
ifstream in("sample_text");
string word;
// Add all the words to the file, one at a time
while (in >> word)
file.push_back(word); // need to push the current word onto the vector
// Iterate through the words, looking for the word "the"
for (int i = 0; i <= file.size(); i++) {
cout << file[i] << " ";
if (file[i] == "the" || file[i] == "The")
count++;
}
cout << "The number of times the word \"the\" was used is: " << count << endl;
return 0;
}