  We study a duality of 5d maximally supersymmetric Yang-Mills on S^1, which
exchanges the tower of Kaluza-Klein W-bosons and the tower of instantonic
monopoles. This duality maps a non-simply-laced gauge theory to a simply-laced
gauge theory twisted by an outer automorphism around S^1, and is closely
related to the Langlands dual of affine Lie algebras.
  We also discuss how this S-duality is implemented in terms of 6d N=(2,0)
theory. This is straightforward except for the 6d theory of type SU(2n+1) with
Z_2 outer-automorphism twist, for which a few new properties are deduced. For
example, this 6d theory, when reduced on an S^1 with Z_2 twist, gives 5d
USp(2n) theory with nontrivial discrete 5d theta angle.
