{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eYou are given a non-empty sequence of letters \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e\", and \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e\". Find the number of ways to swap two \u003cspan class\u003d\"tex-font-style-bf\"\u003edistinct\u003c/span\u003e letters (distinct by value, you are \u003cspan class\u003d\"tex-font-style-bf\"\u003enot allowed\u003c/span\u003e to pick two equal letters at distinct positions) in this sequence so that the resulting sequence is \u003cspan class\u003d\"tex-font-style-it\"\u003ecorrect\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eA correct sequence of letters is defined as follows:\u003c/p\u003e\u003cul\u003e\u003cli\u003e An empty sequence is correct.\u003c/li\u003e\u003cli\u003e If \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eA\u003c/i\u003e\u003c/span\u003e is a correct sequence, then \u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e\u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eA\u003c/i\u003e\u003c/span\u003e\u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e\u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eA\u003c/i\u003e\u003c/span\u003e\u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e, and \u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e\u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eA\u003c/i\u003e\u003c/span\u003e\u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e are correct as well.\u003c/li\u003e\u003cli\u003e If \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eA\u003c/i\u003e\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eB\u003c/i\u003e\u003c/span\u003e are correct sequences, then \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eAB\u003c/i\u003e\u003c/span\u003e (concatenation of \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eA\u003c/i\u003e\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eB\u003c/i\u003e\u003c/span\u003e) is correct as well.\u003c/li\u003e\u003cli\u003e Sequences that cannot be obtained by rules above are not correct.\u003c/li\u003e\u003c/ul\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe only line contains a non-empty sequence of characters \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e\", and \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e\". The length of the sequence does not exceed \u003cspan class\u003d\"tex-span\"\u003e100 000\u003c/span\u003e characters.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint one number\u0026nbsp;— the number of ways to swap two distinct letters so that the resulting sequence is correct.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\u003eabba\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\u003eabcabc\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\u003eaaba\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first sample we can obtain correct sequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003cspan class\u003d\"tex-font-style-underline\"\u003ea\u003c/span\u003eb\u003cspan class\u003d\"tex-font-style-underline\"\u003eb\u003c/span\u003e\u003c/span\u003e\" and «\u003cspan class\u003d\"tex-font-style-tt\"\u003e\u003cspan class\u003d\"tex-font-style-underline\"\u003eb\u003c/span\u003eb\u003cspan class\u003d\"tex-font-style-underline\"\u003ea\u003c/span\u003ea\u003c/span\u003e» by swapping letters. Note that the initial sequence may be correct, but it is not allowed to leave it unchanged.\u003c/p\u003e\u003cp\u003eIn the second sample we can obtain correct sequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eab\u003cspan class\u003d\"tex-font-style-underline\"\u003eb\u003c/span\u003ea\u003cspan class\u003d\"tex-font-style-underline\"\u003ec\u003c/span\u003ec\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003cspan class\u003d\"tex-font-style-underline\"\u003ec\u003c/span\u003eb\u003cspan class\u003d\"tex-font-style-underline\"\u003ea\u003c/span\u003e\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003cspan class\u003d\"tex-font-style-underline\"\u003ec\u003c/span\u003ecab\u003cspan class\u003d\"tex-font-style-underline\"\u003eb\u003c/span\u003e\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003cspan class\u003d\"tex-font-style-underline\"\u003ea\u003c/span\u003ec\u003cspan class\u003d\"tex-font-style-underline\"\u003eb\u003c/span\u003ebc\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e\u003cspan class\u003d\"tex-font-style-underline\"\u003eb\u003c/span\u003ebca\u003cspan class\u003d\"tex-font-style-underline\"\u003ea\u003c/span\u003ec\u003c/span\u003e\", and \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e\u003cspan class\u003d\"tex-font-style-underline\"\u003ec\u003c/span\u003eb\u003cspan class\u003d\"tex-font-style-underline\"\u003ea\u003c/span\u003eabc\u003c/span\u003e\".\u003c/p\u003e\u003cp\u003eIn the third sample the number of \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e\" letters is odd, hence making a correct sequence is impossible.\u003c/p\u003e"}}]}