#include <iostream>
#include <map>
#include <string>

//参考：ttp://tokyo-ct.net/usr/kosaka/for_students/jissen1/akiyojissen1/kougi17.html

std::map<char, int> BMCount(std::string str){
	std::map<char, int> R;

	for (std::size_t i = 1; i < str.size(); i++){
		R[str[i - 1]] = str.size() -i;
	}
		R[str.back()] = str.size();
	return R;
}

bool Show(std::map<char, int>& m){
	for (auto& o : m){
		std::cout << o.first << " ->" << o.second << ", ";
	}
	std::cout<<std::endl;
	return true;
}

int main(){

	auto R= BMCount("hello");
	Show(R);
	R = BMCount("boyer-moore");
	Show(R);
	R = BMCount("abcdefghijklnmopqrstuvwxyz");
	Show(R);
	return 0;

}