In addition to
Utilitarian's advice I would only add, take a look at the tutorials for the string manipulation functions substr, index, rindex, the index and rindex allow you to get the first and last position of a particular amino acid in your sequence, using these functions is direct forward.
Here are the links Index,
rindex,
substr, and In Italiano.
Have a happy programming experience :)
Excellence is an Endeavor of Persistence.
Chance Favors a Prepared Mind.