Write a program that processes a sequence of cases. Each case consists of three names of aminoacid types A, B, C, followed by a protein (a sequence of aminoacid codes) ended with the word END. For each case, the program must list the triplets of consecutive amioacids in the protein such as the first one belongs to type A, the second to type B, and the third to type C. The total amount of found triplets for each protein must also be printed.
The known aminoacid codes are: ala (alanine), arg (arginine), asn (asparagine), asp (aspartic acid), cys (cysteine), gln (glutamine), glu (glutamic acid), gly (glycine), his (histidine), ile (isoleucine), leu (leucine), lys (lysine), met (methionine), phe (phenylalanine), pro (proline), ser (serine), thr (threonine), trp (tryptophan), tyr (tyrosine), val (valine).
The aminoacid types are:
aliphatic: ['ala', 'gly', 'ile', 'leu', 'pro', 'val'] aromatic: ['phe', 'trp', 'tyr'] acidic: ['asp', 'glu'] basic: ['arg', 'his', 'lys'] hydroxylic: ['ser', 'thr'] sulphur: ['cys', 'met'] amidic: ['asn', 'gln']
Input
The input is a sequence of cases. Each case starts with three aminoacid types. Then, a sequence of aminoacid codes follows, ended with the word END. There are no restrictions on the length of the protein.
Output
The output is, for each case, the list of consecutive triplets matching the three given types, plus the total number of found triplets. Print a blank line after each case. Follow the format of the examples.
Observation
Note 1: You can use any data structure you find useful to store which aminoacids belong to which group.
Note 2: Solutions storing the whole aminoacid sequence will receive a severe score penalty.
Input
basic sulphur aliphatic phe lys leu tyr val lys met ala val val lys asn his arg cys gly ala ala END sulphur basic acidic lys cys his asp ile glu val pro END hydroxylic hydroxylic sulphur thr lys glu asp leu gln thr cys thr cys cys tyr thr phe asp his met ser ser END amidic acidic amidic gln glu gln asn asp asn trp gly pro pro asn val asn glu asn ile ala gln asp gln END basic basic basic his his arg phe arg lys lys pro END sulphur hydroxylic aliphatic trp gln trp met thr leu cys asn glu lys glu ala met gln pro asn phe ser lys pro trp lys thr asp met ser gly val cys glu thr glu thr tyr phe END
Output
Triplets basic-sulphur-aliphatic in protein 1: lys met ala arg cys gly Total: 2 Triplets sulphur-basic-acidic in protein 2: cys his asp Total: 1 Triplets hydroxylic-hydroxylic-sulphur in protein 3: Total: 0 Triplets amidic-acidic-amidic in protein 4: gln glu gln asn asp asn asn glu asn gln asp gln Total: 4 Triplets basic-basic-basic in protein 5: his his arg arg lys lys Total: 2 Triplets sulphur-hydroxylic-aliphatic in protein 6: met thr leu met ser gly Total: 2
Input
aliphatic aromatic aliphatic ala phe gly trp ile tyr leu phe pro trp val tyr gly END aliphatic aliphatic aliphatic ala ala gly ile ala ala pro asp gln END
Output
Triplets aliphatic-aromatic-aliphatic in protein 1: ala phe gly gly trp ile ile tyr leu leu phe pro pro trp val val tyr gly Total: 6 Triplets aliphatic-aliphatic-aliphatic in protein 2: ala ala gly ala gly ile gly ile ala ile ala ala ala ala pro Total: 5
Input
aliphatic hydroxylic acidic gly gly ile ser glu lys trp trp lys pro trp thr val thr his END hydroxylic acidic aromatic thr tyr END basic hydroxylic aromatic gln END basic basic hydroxylic glu tyr cys pro lys tyr his his END amidic amidic basic END
Output
Triplets aliphatic-hydroxylic-acidic in protein 1: ile ser glu Total: 1 Triplets hydroxylic-acidic-aromatic in protein 2: Total: 0 Triplets basic-hydroxylic-aromatic in protein 3: Total: 0 Triplets basic-basic-hydroxylic in protein 4: Total: 0 Triplets amidic-amidic-basic in protein 5: Total: 0