#!/usr/bin/env cscript #include "stdio.h" #include "string.h" #define ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ" int main(int argc, char *argv[]) { int index = 0; char *string = "AA"; for (char *needle = string; *needle != '\0'; needle++) { index += 'Z' - 'A' + 1; index *= strchr(ALPHABET, *needle) - ALPHABET; } printf("%s → %d\n", string, index); return 0; }