C++ straightforward
\nclass Solution {\npublic:\n    bool validTicTacToe(vector<string>& board) {\n        int cntX = 0;\n        int cntO = 0;\n        for(string s : board)\n    
```\nclass Solution {\npublic:\n    bool validTicTacToe(vector<string>& board) {\n        int cntX = 0;\n        int cntO = 0;\n        for(string s : board)\n        {\n            for(char c : s)\n            {\n                if(c == \'X\') cntX++;\n                else if(c == \'O\') cntO++;\n            }\n        }\n        bool XWin = (board[0] == "XXX" || board[1] == "XXX" || board[2] == "XXX"\n                      ||(board[0][0] == \'X\' && board[1][0] == \'X\' && board[2][0] == \'X\')\n                      ||(board[0][1] == \'X\' && board[1][1] == \'X\' && board[2][1] == \'X\')\n                      ||(board[0][2] == \'X\' && board[1][2] == \'X\' && board[2][2] == \'X\')\n                      ||(board[0][0] == \'X\' && board[1][1] == \'X\' && board[2][2] == \'X\')\n                      ||(board[0][2] == \'X\' && board[1][1] == \'X\' && board[2][0] == \'X\'));\n        bool OWin = (board[0] == "OOO" || board[1] == "OOO" || board[2] == "OOO"\n                      ||(board[0][0] == \'O\' && board[1][0] == \'O\' && board[2][0] == \'O\')\n                      ||(board[0][1] == \'O\' && board[1][1] == \'O\' && board[2][1] == \'O\')\n                      ||(board[0][2] == \'O\' && board[1][2] == \'O\' && board[2][2] == \'O\')\n                      ||(board[0][0] == \'O\' && board[1][1] == \'O\' && board[2][2] == \'O\')\n                      ||(board[0][2] == \'O\' && board[1][1] == \'O\' && board[2][0] == \'O\'));\n        if(XWin) return cntO == cntX-1;\n        if(OWin) return cntO == cntX;\n        return cntX == cntO || cntX-1 == cntO;\n    }\n};\n```
[]