We infer the coding rule by examining the two given examples.
Step 1 — Build the mapping from FRANCE → 654321:
Write FRANCE and its code beneath, then scan letters from right to left assigning increasing integers starting from 1 to each new letter encountered.
FRANCE (scan right → left):
E → 1
C → 2
N → 3
A → 4
R → 5
F → 6
So far mapping: {E:1, C:2, N:3, A:4, R:5, F:6}.
Step 2 — Extend mapping using GERMANY → 9158437:
Scan GERMANY right → left. Reuse existing digits; assign next available integers to new letters in the order encountered.
G E R M A N Y (right → left: Y, N, A, M, R, E, G)
Y is new → next integer is 7 → Y:7
N exists → N:3
A exists → A:4
M is new → next integer 8 → M:8
R exists → R:5
E exists → E:1
G is new → next integer 9 → G:9
Now mapping includes: {E:1, C:2, N:3, A:4, R:5, F:6, Y:7, M:8, G:9}.
Step 3 — Encode YEMEN using this mapping:
Y → 7
E → 1
M → 8
E → 1
N → 3
So YEMEN → 7 1 8 1 3 → 71813.
Therefore correct option is (d) 71813.