*文件名 zgwftozgs.cpp
*Sid: E10914012
*Author Yangxiagnyu
*Description 2012/04/25
*/
#include<iostream>
#include<cstdio>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
#define _CLR(a) memset(a,0,sizeof(a))
#define _lastchar(a) a[(a).length()-1]
using namespace std;
class grammar
{
typedef unsigned char uchar; typedefmultimap<uchar,string>::iterator MMAPI; typedef pair<int,string> MMAPE; typedef map<int,uchar>::iterator MAPI; typedef pair<MMAPI,MMAPI>MMAPRange;