From 07eeed8120616a464dd858c8b5012c47a7f9ae9c Mon Sep 17 00:00:00 2001 From: Kaitou345 <68972628+Kaitou345@users.noreply.github.com> Date: Mon, 30 Aug 2021 06:05:41 +0600 Subject: [PATCH] Updated usage of StackV.h --- StackVclient.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/StackVclient.cpp b/StackVclient.cpp index 693bf5d..881086d 100644 --- a/StackVclient.cpp +++ b/StackVclient.cpp @@ -1,26 +1,26 @@ #include #include -#include "StackV.h"//Use vector implementation of Stack +#include "StackV.h" //Use vector implementation of Stack using namespace std; -string reverseString(string str) +string reverseString(const string& str) { - string res; - Stack stk; - - for (auto ch : str ) - stk.push(ch); + string result; + Stack stk; + + for (auto ch : str ) + stk.push(ch); while( stk.size() > 0) - { - res += stk.top(); - stk.pop(); - } + { + result += stk.top(); + stk.pop(); + } - return res; + return result; }