{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv style\u003d\"width:30.00%\" class\u003d\"illustration\"\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/375e358a8ef4be835f56fbd84bcb00af?v\u003d1715957960\" alt\u003d\"/problems/summertrip/file/statement/en/img-0001.jpg\" class\u003d\"illustration\"\u003e\n \n \u003c/div\u003e\n \u003cp\u003eLeo has started a job in a travel agency. His first task is\n to organize a summer trip to an exotic overseas city. During\n the summer season, events of various types take place in the\n city: sports matches, concerts, beach parties, and many others.\n At any given time, there is exactly one event taking place.\n Events of any particular type may take place more than once\n during the season. The itinerary of events that Leo offers to\n his clients cannot be chosen arbitrarily; the company requires\n them to form a so-called “good itinerary.” A good itinerary is\n a consecutive sequence of at least two events in the summer\n season, where the first and last events are of different types,\n and they are both unique among all event types during the\n sequence. For example, if the first event in a good itinerary\n is a beach party, none of the other events during the itinerary\n can also be a beach party. There are no other restrictions on\n the event types in the sequence of a good itinerary.\u003c/p\u003e\n \u003cp\u003eBefore he starts organizing the trip, Leo wants to know the\n total number of good itineraries that are possible given a\n calendar of events that will take place over the summer\n season.\u003c/p\u003e\n \u003ch2\u003eInput\u003c/h2\u003e\n \u003cp\u003eThe input consists of one line with a string describing the\n sequence of event types in the summer season. All characters\n are lowercase English letters (\u003ctt class\u003d\"ttfamily\"\u003e’a’\u003c/tt\u003e –\n \u003ctt class\u003d\"ttfamily\"\u003e’z’\u003c/tt\u003e), with different letters\n represent different types of events. Character \u003cspan class\u003d\"tex2jax_process\"\u003e$i$\u003c/span\u003e of the string encodes the\n \u003cspan class\u003d\"tex2jax_process\"\u003e$i$\u003c/span\u003eth event of the summer.\n There are no blanks or spaces in the string.\u003c/p\u003e\n \u003cp\u003eThe length of the input string is at least \u003cspan class\u003d\"tex2jax_process\"\u003e$2$\u003c/span\u003e and at most \u003cspan class\u003d\"tex2jax_process\"\u003e$100\\, 000$\u003c/span\u003e characters.\u003c/p\u003e\n \u003ch2\u003eOutput\u003c/h2\u003e\n \u003cp\u003ePrint the number of good itineraries that exist for the\n given summer season.\u003c/p\u003e\n \u003ch2\u003eSample 1\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003eabbcccddddeeeee\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e10\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n \u003ch2\u003eSample 2\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003ethenumberofgoodstringsis\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e143\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}