class Solution {
public:
vector<string> findWords(vector<string>& words) {
string s1 = "qwertyuiopQWERTYUIOP";
string s2 = "asdfghjklASDFGHJKL";
string s3 = "zxcvbnmZXCVBNM";
bool hashTable[3][256] = {false};
for(int i = 0; i < s1.length(); i++) {
hashTable[0][s1[i]] = true;
}
for(int i = 0; i < s2.length(); i++) {
hashTable[1][s2[i]] = true;
}
for(int i = 0; i < s3.length(); i++) {
hashTable[2][s3[i]] = true;
}
vector<string> result;
for(int i = 0; i < words.size(); i++) {
string curruntStr = words[i];
int result0 = true, result1 = true, result2 = true;
for(int j = 0; j < curruntStr.length(); j++) {
result0 = result0 && hashTable[0][curruntStr[j]];
}
for(int j = 0; j < curruntStr.length(); j++) {
result1 = result1 && hashTable[1][curruntStr[j]];
}
for(int j = 0; j < curruntStr.length(); j++) {
result2 = result2 && hashTable[2][curruntStr[j]];
}
if(result0 || result1 || result2) {
result.push_back(curruntStr);
}
}
return result;
}
};