void recur(string& s, vector<vector<string>>& res, vector<string>& path, int index) {
     if (index == s.size()) {
         res.push_back(path);
         return;
     }
     string palindrom;
     for (int i = index; i < s.size(); ++i) {
         palindrom.push_back(s[i]);
         if (!isPalindrom(palindrom)) continue;
         
         path.push_back(palindrom);
         recur(s, res, path, i+1);
         path.pop_back();
     }
 }
示例#2
0
int
main(int argc, char** argv) {

  std::stringstream numberSS;
  int currMax = 0;
  for (int i = 999; i >= 100; --i) {
    for (int j = i; j >= 100; --j) {
      numberSS << i*j;
      if (isPalindrom(numberSS.str())) {
        if (i*j > currMax)
          currMax = i*j;
      }
      numberSS.str(std::string());
    }
  } 

  std::cout << "Max: " <<  currMax << std::endl;
  return 0;
}
示例#3
0
文件: task10.cpp 项目: artbez/origin
int main()
{

    const int size = 1000;
    char mainStr[size];

    printf("Enter a string \n");
    scanf("%s", mainStr);

    if (isPalindrom(mainStr))
    {
        printf("This is a palindrom");
    }
      else
    {
        printf("This is not a palindrom");
    }

    return 0;
}