Stores direction changes
Map < Character , Character > rcd = new HashMap < > ( ) ; rcd . put ( ' l ' , ' u ' ) ; rcd . put ( ' u ' , ' r ' ) ; rcd . put ( ' r ' , ' d ' ) ; rcd . put ( ' d ' , ' l ' ) ;