AOJ 0578 - Signboard

lambdaつかって書きやすく,でも見難くなりました.
受けたときより10行減りました.

#include<iostream>
#include<vector>

std::vector<int> findChar(const std::string &str, const char search_c){
	std::vector<int> res;
	for(int pos=0;pos=str.find(search_c, pos), pos!=std::string::npos;){
		res.push_back(pos);
		pos++;
	}
	return res;
}

bool create(const std::string &name, const std::string &plate){
	std::vector<int> first_p = findChar(plate, name[0]), second_p = findChar(plate, name[1]);

	for(int i=0;i<first_p.size();i++){
		for(int j=0;j<second_p.size();j++){
			int padding = second_p[j] - first_p[i];
			if(padding < 0)continue;
			
			if([&](){
					for(int k=2;k<name.size();k++){
						int pos = first_p[i] + padding * k;
						if(pos >= plate.size() || plate[pos] != name[k])return false;
					}
					return true;
				}())
			{
				return true;
			}
		}
	}
	
	return false;
}

int main(){
	int n;
	std::string name, plate;
	std::cin >> n;
	std::cin >> name;

	int result = 0;
	for(int i=0;i<n;i++){
		std::cin >> plate;
		if(create(name, plate)){
			result++;
		}
	}
	std::cout << result << std::endl;
}