Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#include <string>#include <vector>#include <set>using namespace std;int diffChar(string str){//查找字符串中包含的不同字符的个数vector<int> help(26, 0);for(char c : str){help[c - 'a'] = 1;}int ans = 0;for(int n : help)ans += n;return ans;}void findLuckySubstr(string str, set<string> &ans){vector<int> help(101, 0);help[0] = 1;help[1] = 1;int fn_1 = 1, fn_2 = 0, fn = 0;while(fn < 101){//fibonacci 数组,100以内,如果下标是fibonacci 数,则数组值为1.fn = fn_1 + fn_2;if(fn < 101){help[fn] = 1;fn_2 = fn_1;fn_1 = fn;}}int len = str.length();for(int i = 0; i < len; i++)//所有的子字符串for(int j = 1; j <= len - i; j++){