#!/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 = "Z"; char *needle; column_index = 0; for (needle = column_string; *needle != '\0'; needle++) { column_index *= 'Z' - 'A' + 1; column_index += strchr(ALPHABET, *needle) - ALPHABET + 1; } printf("%d\n", column_index); }