You can remember the meaning of 市长 with this easy mnemonic:
It took the city (市) a long (长) time to choose its first female mayor.
Using mnemonics to remember the meaning of Chinese characters like can have an enormous impact on how long to learn Mandarin it takes.