Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

void judge(int i, int sum, string &list) {
  vector<char> ope(3);
  
  if (i == 3) {
    if (sum + stoi(list.at(i)) == 7) {
      ope.at(i - 1) = '+';
      cout << list.at(0) << ope.at(0) << list.at(1)
         << ope.at(1) << list.at(2) << ope.at(2) << list.at(3)
         << "=7" << endl;
      return;
    }
    else if (sum - stoi(list.at(i)) == 7) {
      cout << list.at(0) << ope.at(0) << list.at(1)
         << ope.at(1) << list.at(2) << ope.at(2) << list.at(3)
         << "=7" << endl;
      return;
    }
    else
      return;
  }
}
  
  
  int y = sum + stoi(list.at(i));
  ope.at(i - 1) = '+';
  judge(i + 1, y, list);
  
  y = sum - stoi(list.at(i));
  ope.at(i - 1) = '-';
  judge(i + 1, y, list);
}

int main() {
  string list;
  cin >> list;
  
  judge(1, list.at(0), list);
}

Compiler output:
a.cc: In function 'void judge(int, int, std::string&)':
a.cc:9:19: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
    9 |     if (sum + stoi(list.at(i)) == 7) {
      |               ~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |        ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
 4432 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
 4432 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |        ~~~~~~~~~~~~~~~^~~~~
a.cc:16:24: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
   16 |     else if (sum - stoi(list.at(i)) == 7) {
      |                    ~~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |        ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
 4432 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
 4432 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |        ~~~~~~~~~~~~~~~^~~~~
a.cc: At global scope:
a.cc:28:11: error: 'sum' was not declared in this scope
   28 |   int y = sum + stoi(list.at(i));
      |           ^~~
a.cc:28:26: error: missing template arguments before '.' token
   28 |   int y = sum + stoi(list.at(i));
      |                          ^
a.cc:28:30: error: 'i' was not declared in this scope
   28 |   int y = sum + stoi(list.at(i));
      |                              ^
a.cc:29:3: error: 'ope' does not name a type
   29 |   ope.at(i - 1) = '+';
      |   ^~~
a.cc:30:8: error: expected constructor, destructor, or type conversion before '(' token
   30 |   judge(i + 1, y, list);
      |        ^
a.cc:32:3: error: 'y' does not name a type
   32 |   y = sum - stoi(list.at(i));
      |   ^
a.cc:33:3: error: 'ope' does not name a type
   33 |   ope.at(i - 1) = '-';
      |   ^~~
a.cc:34:8: error: expected constructor, destructor, or type conversion before '(' token
   34 |   judge(i + 1, y, list);
      |        ^
a.cc:35:1: error: expected declaration before '}' token
   35 | }
      | ^