import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.InputMismatchException; public class NationalHighway { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); try{ String string = scanner.next(); if(string.length() != 0){ //Pattern pattern = Pattern.compile("*[R|L|^$]*"); Pattern pattern = Pattern.compile(".*[R|L].*"); Matcher matcher = pattern.matcher(string); if(!matcher.find()){ System.out.println("文字列はRかLだけで入力してください"); System.exit(0); } if(string.length()<0 || string.length() > 30){ System.out.println("文字列は1以上30以下で入力してください"); } } int Road = 1; char[] NewString = string.toCharArray(); for(int i = 0 ; i < string.length() ; i++){ //System.out.print("test"); if(NewString[i] == 'R'){ Road = Road * 2 + 1; }else if(NewString[i] == 'L'){ Road = Road * 2 ; }else{ //何もしない } } System.out.println(Road); }catch(InputMismatchException e){ System.out.println(""); }catch(Exception E){ System.out.println("予期せぬエラーです"); } } }