Language: C++

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main() {
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  
  int dx = abs(tx-sx);
  int dy = abs(ty-sy);
  
  char* rightup = "URDLDRULULDR";
  char* leftdown = "DLURRDLULURD";
  
  char* ans;
  if(tx > sx) ans = rightup;
  else  ans = leftdown;
  
  for(int i = 0; i < dx; i++) printf(ans[0]);
  for(int i = 0; i < dy; i++) printf(ans[1]);
  for(int i = 0; i < dx; i++) printf(ans[2]);
  for(int i = 0; i < dy; i++) printf(ans[3]);

  printf(ans[4]);
  for(int i = 0; i < dx+1; i++) printf(ans[5]);
  for(int i = 0; i < dy+1; i++) printf(ans[6]);
  printf(ans[7]);
  printf(ans[8]);
  for(int i = 0; i < dx+1; i++) printf(ans[9]);
  for(int i = 0; i < dy+1; i++) printf(ans[10]);
  printf(ans[11]);
  
  
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   13 |   char* rightup = "URDLDRULULDR";
      |                   ^~~~~~~~~~~~~~
a.cc:14:20: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   14 |   char* leftdown = "DLURRDLULURD";
      |                    ^~~~~~~~~~~~~~
a.cc:20:43: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   20 |   for(int i = 0; i < dx; i++) printf(ans[0]);
      |                                      ~~~~~^
      |                                           |
      |                                           char
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:21:43: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   21 |   for(int i = 0; i < dy; i++) printf(ans[1]);
      |                                      ~~~~~^
      |                                           |
      |                                           char
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:22:43: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   22 |   for(int i = 0; i < dx; i++) printf(ans[2]);
      |                                      ~~~~~^
      |                                           |
      |                                           char
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:23:43: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   23 |   for(int i = 0; i < dy; i++) printf(ans[3]);
      |                                      ~~~~~^
      |                                           |
      |                                           char
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:25:15: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   25 |   printf(ans[4]);
      |          ~~~~~^
      |               |
      |               char
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:26:45: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   26 |   for(int i = 0; i < dx+1; i++) printf(ans[5]);
      |                                        ~~~~~^
      |                                             |
      |                                             char
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:27:45: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   27 |   for(int i = 0; i < dy+1; i++) printf(ans[6]);
      |                                        ~~~~~^
      |                                             |
      |                                             char
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:28:15: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   28 |   printf(ans[7]);
      |          ~~~~~^
      |               |
      |               char
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:29:15: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   29 |   printf(ans[8]);
      |          ~~~~~^
      |               |
      |               char
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:30:45: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   30 |   for(int i = 0; i < dx+1; i++) printf(ans[9]);
      |                                        ~~~~~^
      |                                             |
      |                                             char
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:31:46: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   31 |   for(int i = 0; i < dy+1; i++) printf(ans[10]);
      |                                        ~~~~~~^
      |                                              |
      |                                              char
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:32:16: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   32 |   printf(ans[11]);
      |          ~~~~~~^
      |                |
      |                char
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~