{"trustable":false,"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\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"MD","content":"Realization! A great treasure that we oftentimes fail to realize. But why? Why can\u0027t we accept our mistakes and face our problems front on? Why do we have to run away from our mistakes? Life will throw you many obstacles and the road will be tough but you will have to face them. Turn around from your mistakes and keep going forward. And the moment we will be able to realize this truth, no one will be able to stop you from reaching your goal.\n\nThis problem is about our lives, turning our life around from our failures and to keep going forward. There are two kinds of options in life \"T\" (turn around) and \"F\" (move 1 unit forward). And you are the one to decide which option you will choose. \n\nYou are given a string of life events consisting \"T\" or \"F\". You have to change exactly **n** events from the string. You can change an event multiple times. You have to find out how far in life you can go following the changed path."}},{"title":"Input","value":{"format":"MD","content":"The first line of input contains a string containing life events — the original one. The string\n contains between 1 and 100 characters. The string will only have character \"T\" or \"F\".\nThe second line contains an integer **n (1 ≤ n ≤ 50)**, denoting the number of events you have to change."}},{"title":"Output","value":{"format":"MD","content":"Output the maximum distance you can reach in your life after you have modified some of your life events."}},{"title":"Sample Input 1","value":{"format":"MD","content":"```\nFFFFTFTF\n1\n```"}},{"title":"Sample Output 1","value":{"format":"MD","content":"```\n5\n```"}},{"title":"Sample Input 2","value":{"format":"MD","content":"```\nFT\n1\n```"}},{"title":"Sample Output 2","value":{"format":"MD","content":"```\n2\n```"}}]}