https://www.acmicpc.net/problem/16969
26 × 25import java.util.Scanner;
public class Main {
static final int MOD = 1_000_000_009;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String pattern = sc.nextLine();
long result = 1;
// 번호판 형식의 각 자리를 순회
for (int i = 0; i < pattern.length(); i++) {
char current = pattern.charAt(i); // 현재 자리
int choices = 0; // 현재 자리에 가능한 경우의 수
// 현재 자리가 문자 자리일 경우
if (current == 'c') {
choices = 26; // 알파벳 26가지 가능
}
// 현재 자리가 숫자 자리일 경우
else if (current == 'd') {
choices = 10; // 숫자 10가지 가능
}
// 이전 문자와 현재 문자가 같으면 중복 제거
if (i > 0 && pattern.charAt(i) == pattern.charAt(i - 1)) {
choices -= 1; // 같은 종류 연속 시 중복 제거
}
// 가능한 경우의 수를 누적 계산, 나누기
result = (result * choices) % MOD;
}
System.out.println(result);
}
}