Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define ll long long 
#define pb(a) push_back(a)
#define fi first
#define se second
#define rep(a,b,c) for(int a = b ;a<=c;a++)
#define repn(a,b,c) for(int a = b ; a>=c ; a--)
#define FOR(a,b,c) for(int a = b ; a<c ;a++)
#define mem(a,b) memset(a,b , sizeof(a))
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define size(a) ((int)a.size())
#define ii int
#define umap unordered_map
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a * b / gcd(a,b)
const int INF=0x3f3f3f3f;
const int maxn=5e5+10;
#define  max(a,b) (a > b) ? a : b;
#define  min(a,b) (a > b) ? b : a;
#define  st(a) setprecision(a)
#define fix_ std::fixed
#define TC(t) while(t--)
#define PERMUTE next_permutation
#define Get GetString()
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}



inline string IntToString(ll a){
  char x[100];
  sprintf(x,"%lld",a); string s = x;
  return s;
}
 
inline ll StringToInt(string a){
  char x[100]; ll res;
  strcpy(x,a.c_str()); sscanf(x,"%lld",&res);
  return res;
}

inline string GetString(void){
  char x[1000005];
  scanf("%s",x); string s = x;
  return s;
}
 
inline string uppercase(string s){
  int n = size(s); 
  FOR(i,0,n) if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
  return s;
}
 
inline string lowercase(string s){
  int n = size(s); 
  FOR(i,0,n)if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
  return s;
}

void input(){
	freopen("in.txt", "r",stdin);
	freopen("out.txt", "w",stdout);
}
void fast(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	 cout.tie(NULL);
}



void solve(){
  
  ii a,b,c,d;

  string s;
  cin>>s;

  a = (ii)s[0] - '0';
  b = (ii)s[1] - '0';
  c = (ii)s[2] - '0';
  d = (ii)s[3] - '0';

  int arr[3] = {b,c,d};

  //for(int x : arr) cout<<x<<endl;
  
  int g[8][3] ={
    {0,0,0},{0,0,1},{0,1,0},{1,0,0},{1,1,0},{1,0,1},{0,1,1},{1,1,1}
  }; 


  for(int coba = 0; coba <= 7 ; coba++){
    int ans = a;

    for(int i = 0; i <= 2; i ++ ){
      if(g[coba][i] == 0) ans +=arr[i];
      if(g[coba][i] == 1) ans -=arr[i];

     // cout<<ans<<endl;
    }

    //cout<<coba<<" - >" <<ans<<endl;

    if(ans == 7){
      vector<char>answer;
      char l1,l2,l3;

      if(g[coba][0] == 0)
        l1 = '+';
      else
        l1 ='-';


      if(g[coba][1] == 0)
        l2 = '+';
      else
        l2 ='-';


      if(g[coba][2] == 0)
        l3 = '+';
      else
        l3 ='-';

      char x1,x2,x3,x4;

      x1 = (char)(a+'0');
      x2 = (char)(b+'0');
      x3 = (char)(c+'0');
      x4 = (char)(d+'0');

     // cout<<x1<<x2<<x3<<x4<<endl;

      answer.pb(x1);
      answer.pb(l1);
      answer.pb(x2);
      answer.pb(l2);
      answer.pb(x3);
      answer.pb(l3);
      answer.pb(x4);
      answer.pb('=');
      answer.pb('7');

      for(auto x : answer){
        cout<<x;
      }

      cout<<endl;

      exit(0);
    }

  }

} 


int main(){
	fast();
	solve();
	 exit(0);
}



Compiler output:
a.cc: In function 'long long int StringToInt(std::string)':
a.cc:61:3: error: 'strcpy' was not declared in this scope
   61 |   strcpy(x,a.c_str()); sscanf(x,"%lld",&res);
      |   ^~~~~~
a.cc:20:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   19 | #include <queue>
  +++ |+#include <cstring>
   20 | #include <stdio.h>