Help With Time Complexity
I'm having trouble figuring out the time complexity of my program, can anyone please compute it for me and then explain how they got that answer? I'm an amateur and really have no clue how to do so. Thanks.

    #include <iostream>
    #include <stack>
    #include <string>
    
    
    using namespace std;
    
    int prec(char op)
    {
        if (op == '*' || op == '/' || op == '+' || op == '-') return 0;
        return 1;
    }
    
    bool compareprec(char a, char b)
    {
        return prec(a) < prec(b);
    
    }
    
    int main()
    {
        stack<char> s;
        char input;
        while (cin.get(input) && input != '\n')
            {
                if (isalnum(input))
                    cout << input << " ";
                else if (input == '(')
                    s.push(input);
                else if (input == ')')
                {
         while (!s.empty() && s.top() != '(')
             {
          cout << s.top() << " ";
          s.pop();
      }
             if(!s.empty()) 
                        s.pop();
             else
                    cout << "ERROR: No Matching ( \n";
         }
      else if (s.empty() && input == '*'|| input == '/'|| input == '+'|| input == '-') 
      {
                 s.push(input);
      }
             else if (input == '*'||input == '/'||input == '+'|| input =='-')
                 while (!s.empty()) 
           {
               cout << s.top() << "\n ";
        s.pop();
                      s.push(input);
           }
            }
        while (!s.empty())
        {
            cout << s.top() << " ";
            s.pop();
        }
    }


Help With Time Complexity
===

I'm having trouble figuring out the time complexity of my program, can anyone please compute it for me and then explain how they got that answer? I'm an amateur and really have no clue how to do so. Thanks.

    #include <iostream>
    #include <stack>
    #include <string>
    
    
    using namespace std;
    
    int prec(char op)
    {
        if (op == '*' || op == '/' || op == '+' || op == '-') return 0;
        return 1;
    }
    
    bool compareprec(char a, char b)
    {
        return prec(a) < prec(b);
    
    }
    
    int main()
    {
        stack<char> s;
        char input;
        while (cin.get(input) && input != '\n')
            {
                if (isalnum(input))
                    cout << input << " ";
                else if (input == '(')
                    s.push(input);
                else if (input == ')')
                {
         while (!s.empty() && s.top() != '(')
             {
          cout << s.top() << " ";
          s.pop();
      }
             if(!s.empty()) 
                        s.pop();
             else
                    cout << "ERROR: No Matching ( \n";
         }
      else if (s.empty() && input == '*'|| input == '/'|| input == '+'|| input == '-') 
      {
                 s.push(input);
      }
             else if (input == '*'||input == '/'||input == '+'|| input =='-')
                 while (!s.empty()) 
           {
               cout << s.top() << "\n ";
        s.pop();
                      s.push(input);
           }
            }
        while (!s.empty())
        {
            cout << s.top() << " ";
            s.pop();
        }
    }

