Judging strictly from your question, all of the variables declared inside of getLCS will die after the function is done if they are declared on the stack (no naked new
of any kind). Nothing else should live beyond that. Calling the static function also does not create a new LCS
class: static functions on classes behave almost exactly like free-functions, except they can have access modifiers placed on them for scoping within the class. Static data and methods operate independently of their classes unless you explicitly use and intermingle them in member functions.
EDIT:
Note that this is true of ALL C++ functions. Objects and primitives that are made on the stack will die/go-out-of-scope when that function / scope dies. As bonus fun, you can even create scope
by slapping some braces { /* ... */ }
around some code arbitrarily! But it's usually not necessary to do stuff like that.
Good luck!