s=gets 1until s==sub(/.[a-z]*$/){print $&.swapcase}