Language: C++

//
// Created by 拓真 on 2018/07/05.
//

#include "bits/stdc++.h"
using namespace std;
typedef string::const_iterator State;
class ParseError{};

void consume(State &begin,char expected){
    if(*begin==expected){
        begin++;
    }else{
        cerr<<"Expected "<<expected<<"but got"<<*begin<<endl;
        cerr<<"Rest String is";
        while(*begin){
            cerr<<*begin;
        }
        cerr<<endl;
        throw ParseError();
    }
}



set<int> expression(State &begin){

    set<int> ret;
    set<int> par;


    if(isdigit(*begin)){
        int num0=*begin;
        begin++;
        if(*begin=='+'){
            begin++;
            if(*begin=='('){
                consume(begin,'(');
                par=expression(begin);
                consume(begin,')');
            }else {
                if(isdigit(*begin)) {
                    par.insert(*begin);
                }
            }

        }else if(*begin=='-'){
            begin++;
            if(*begin=='('){
                consume(begin,'(');
                par=expression(begin);
                consume(begin,')');
            }else {
                if(isdigit(*begin)) {
                    par.insert(*begin);
                }
            }


        }else if(*begin=='*'){
            begin++;
            if(*begin=='('){
                consume(begin,'(');
                par=expression(begin);
                consume(begin,')');
            }else {
                if(isdigit(*begin)) {
                    par.insert(*begin);
                }
            }

        }else if(*begin =='/'){
            begin++;
            if(*begin=='('){
                consume(begin,'(');
                par=expression(begin);
                consume(begin,')');
            }else {
                if(isdigit(*begin)) {
                    par.insert(*begin);
                }else{
                    throw ParseError();

                }
            }



        }

    }else{
        throw ParseError();
    }


    vector<int> vec;
    for(int i=0;i<par.size();i++){
        vec.push_back(i);
    }

    do{

        par[vec]

    }while(vec.begin(),vec.end());



    return ret;

}


int main(){


    string s;
    while(cin>>s){
        if(s[0]=='#')break;
        State begin=s.begin();

        set<int>ans=expression(begin);
        cout<<ans.size()<<endl;
    }

}


Compiler output:
a.cc: In function 'std::set<int> expression(State&)':
a.cc:103:12: error: no match for 'operator[]' (operand types are 'std::set<int>' and 'std::vector<int>')
  103 |         par[vec]
      |            ^
a.cc:105:21: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::begin() [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator]', declared with attribute 'nodiscard' [-Wunused-result]
  105 |     }while(vec.begin(),vec.end());
      |            ~~~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_vector.h:873:7: note: declared here
  873 |       begin() _GLIBCXX_NOEXCEPT
      |       ^~~~~
a.cc:105:23: error: could not convert '(((void)vec.std::vector<int>::begin()), vec.std::vector<int>::end())' from 'std::vector<int>::iterator' to 'bool'
  105 |     }while(vec.begin(),vec.end());
      |            ~~~~~~~~~~~^~~~~~~~~~
      |                       |
      |                       std::vector<int>::iterator