func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:102400000,102400000 )   using namespace std;   int n, m, ans, flag;   bool vis[10];   string fac[7] = { 1869 ,  1968 ,  1689 ,  6198 ,  8691 ,  8916 ,  1896 };   string s, ss, anss, xx =  0000 ;   int main() {     int i, j, t, pos, x, y, u, v, w;     while (cin >> s) {       memset(vis, 0, sizeof(vis));       ss =   ;       for (i = 0; i < s.length(); i++) {         if (s[i] ==  1 ) {           if (!vis[1])             vis[1] = 1;           else             ss += s[i];         } else if (s[i] ==  6 ) {           if (!vis[6])             vis[6] = 1;           else             ss += s[i];         } else if (s[i] ==  8 ) {           if (!vis[8])             vis[8] = 1;           else             ss += s[i];         } else if (s[i] ==  9 ) {           if (!vis[9])             vis[9] = 1;           else             ss += s[i];         } else           ss += s[i];       }       flag = 0;       for (i = 0; i < ss.length(); i++) {         if (ss[i] !=  0 ) {           flag = 1;           char c = ss[i];           ss[i] = ss[0];           ss[0] = c;         }       }       if (!flag) {         cout <<  1869  << ss << endl;       } else {         t = 0;         for (i = 0; i < ss.length(); i++) {           t = (t * 10 + ss[i] -  0 ) % 7;         }         for (i = 0; i < 4; i++) {           t = (t * 10 + xx[i] -  0 ) % 7;         }         if (t) t = 7 - t;         cout << ss << fac[t] << endl;       }     }     return 0;   }   