CCC Practice
CCC Practice
#include <vector>
#include <string>
string word;
int R, C;
vector<vector<string>> area;
int search(int r, int c, bool turned, int i, int dr, int dc) {
if (!(0 <= r && r < R && 0 <= c && c < C)) // out of bounds
return 0;
if (area[r][c] != string(1, word[i])) // didn't match word
return 0;
if (i == word.length() - 1) // found word
return 1;
int main() {
cin >> word;
cin >> R >> C;
area.resize(R, vector<string>(C));
vector<pair<int, int>> dir_check = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}, {1, 1},
{-1, -1},
{1, -1}, {-1, 1}};
int total = 0;