a=gets;1until print||a[sub /.[a-z]*$/,&:swapcase]