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