#include <stdio.h>                                                                                                                                         
#include <stdlib.h>                                                                                                                                        
                                                                                                                                                           
#define calc01(num) (num[0] + num[1] + num[2] + num[3])                                                                                                    
#define calc02(num) (num[0] + num[1] + num[2] - num[3])                                                                                                    
#define calc03(num) (num[0] + num[1] - num[2] + num[3])                                                                                                    
#define calc04(num) (num[0] + num[1] - num[2] - num[3])                                                                                                    
#define calc05(num) (num[0] - num[1] + num[2] + num[3])                                                                                                    
#define calc06(num) (num[0] - num[1] + num[2] - num[3])                                                                                                    
#define calc07(num) (num[0] - num[1] - num[2] + num[3])                                                                                                    
#define calc08(num) (num[0] - num[1] - num[2] - num[3])                                                                                                    
                                                                                                                                                           
int main(void)                                                                                                                                             
{                                                                                                                                                          
        char in[5] = { 0 };                                                                                                                                
        int num[4];                                                                                                                                        
        int i;                                                                                                                                             
        char tmp[2] = { 0 };                                                                                                                               
                                                                                                                                                           
        scanf("%s", in);                                                                                                                                   
                                                                                                                                                           
        for (i = 0; i < 4; i++) {                                                                                                                          
                tmp[0] = in[i];                                                                                                                            
                num[i] = atoi(tmp);                                                                                                                        
        }                                                                                                                                                  
                                                                                                                                                           
        if (calc01(num) == 7) {                                                                                                                            
                printf("%d+%d+%d+%d=7\n", num[0], num[1], num[2], num[3]);                                                                                 
        } else if (calc02(num) == 7) {                                                                                                                     
                printf("%d+%d+%d-%d=7\n", num[0], num[1], num[2], num[3]);                                                                                 
        } else if (calc03(num) == 7) {                                                                                                                     
                printf("%d+%d-%d+%d=7\n", num[0], num[1], num[2], num[3]);                                                                                 
        } else if (calc04(num) == 7) {                                                                                                                     
                printf("%d+%d-%d-%d=7\n", num[0], num[1], num[2], num[3]);                                                                                 
        } else if (calc05(num) == 7) {                                                                                                                     
                printf("%d-%d+%d+%d=7\n", num[0], num[1], num[2], num[3]);                                                                                 
        } else if (calc06(num) == 7) {                                                                                                                     
                printf("%d-%d+%d-%d=7\n", num[0], num[1], num[2], num[3]);                                                                                 
        } else if (calc07(num) == 7) {                                                                                                                     
                printf("%d-%d-%d+%d=7\n", num[0], num[1], num[2], num[3]);                                                                                 
        } else if (calc08(num) == 7) {                                                                                                                     
                printf("%d-%d-%d-%d=7\n", num[0], num[1], num[2], num[3]);                                                                                 
        }                                                                                                                                                  
        return 0;                                                                                                                                          
}

Measured memory_bytes: 128