{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eAtCoDeer the deer and his friend TopCoDeer is playing a game.\r\nThe game consists of \u003cvar\u003e\\(N\\)\u003c/var\u003e turns.\r\nIn each turn, each player plays one of the two \u003cem\u003egestures\u003c/em\u003e, \u003cem\u003eRock\u003c/em\u003e and \u003cem\u003ePaper\u003c/em\u003e, as in Rock-paper-scissors, under the following condition:\u003c/p\u003e\r\n\u003cp\u003e(※) After each turn, (the number of times the player has played Paper)\u003cvar\u003e\\(≦\\)\u003c/var\u003e(the number of times the player has played Rock).\u003c/p\u003e\r\n\u003cp\u003eEach player\u0027s score is calculated by (the number of turns where the player wins) \u003cvar\u003e\\(-\\)\u003c/var\u003e (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\u003c/p\u003e\r\n\u003cp\u003e\u003cem\u003e(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\u003c/em\u003e\u003c/p\u003e\r\n\u003cp\u003eWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the \u003cvar\u003e\\(N\\)\u003c/var\u003e turns, before the game starts.\r\nPlan AtCoDeer\u0027s gesture in each turn to maximize AtCoDeer\u0027s score.\u003c/p\u003e\r\n\u003cp\u003eThe gesture that TopCoDeer will play in each turn is given by a string \u003cvar\u003e\\(s\\)\u003c/var\u003e. If the \u003cvar\u003e\\(i\\)\u003c/var\u003e-th \u003cvar\u003e\\((1≦i≦N)\\)\u003c/var\u003e character in \u003cvar\u003e\\(s\\)\u003c/var\u003e is \u003ccode\u003eg\u003c/code\u003e, TopCoDeer will play Rock in the \u003cvar\u003e\\(i\\)\u003c/var\u003e-th turn. Similarly, if the \u003cvar\u003e\\(i\\)\u003c/var\u003e-th \u003cvar\u003e\\((1≦i≦N)\\)\u003c/var\u003e character of \u003cvar\u003e\\(s\\)\u003c/var\u003e in \u003ccode\u003ep\u003c/code\u003e, TopCoDeer will play Paper in the \u003cvar\u003e\\(i\\)\u003c/var\u003e-th turn.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1≦N≦10^5\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(N\u003d|s|\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003eEach character in \u003cvar\u003e\\(s\\)\u003c/var\u003e is \u003ccode\u003eg\u003c/code\u003e or \u003ccode\u003ep\u003c/code\u003e.\u003c/li\u003e\r\n\u003cli\u003eThe gestures represented by \u003cvar\u003e\\(s\\)\u003c/var\u003e satisfy the condition (※).\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eThe input is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(s\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003ePrint the AtCoDeer\u0027s maximum possible score.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 1","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\u003egpg\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003ePlaying the same gesture as the opponent in each turn results in the score of \u003cvar\u003e\\(0\\)\u003c/var\u003e, which is the maximum possible score.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 2","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\u003eggppgggpgg\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of \u003cvar\u003e\\(2\\)\u003c/var\u003e, which is the maximum possible score.\u003c/p\u003e\u003c/section\u003e\r\n"}}]}