func_code_string: #include <bits/stdc++.h>   using namespace std;   int t, num[30], ans;   char s[100005];   int main() {     cin >> t;     while (t--) {       ans = 0;       memset(num, 0, sizeof(num));       scanf( %s , s + 1);       int len = strlen(s + 1);       for (int i = 1; i <= len; i++) {         num[s[i] -  A  + 1]++;       }       if (num[ L  -  A  + 1] != 0 && num[ R  -  A  + 1] != 0 &&           (num[ U  -  A  + 1] == 0 || num[ D  -  A  + 1] == 0)) {         printf( 2 n );         printf( LR n );       } else if (num[ U  -  A  + 1] != 0 && num[ D  -  A  + 1] != 0 &&                  (num[ L  -  A  + 1] == 0 || num[ R  -  A  + 1] == 0)) {         printf( 2 n );         printf( UD n );       } else if (num[ L  -  A  + 1] != 0 && num[ R  -  A  + 1] != 0 &&                  num[ U  -  A  + 1] != 0 && num[ D  -  A  + 1] != 0) {         ans += min(num[ L  -  A  + 1], num[ R  -  A  + 1]) * 2;         ans += min(num[ U  -  A  + 1], num[ D  -  A  + 1]) * 2;         printf( %d n , ans);         for (int i = 1; i <= min(num[ L  -  A  + 1], num[ R  -  A  + 1]); i++) {           printf( L );         }         for (int i = 1; i <= min(num[ U  -  A  + 1], num[ D  -  A  + 1]); i++) {           printf( U );         }         for (int i = 1; i <= min(num[ L  -  A  + 1], num[ R  -  A  + 1]); i++) {           printf( R );         }         for (int i = 1; i <= min(num[ U  -  A  + 1], num[ D  -  A  + 1]); i++) {           printf( D );         }         printf(  n );       } else {         printf( 0 n n );       }     }   }   