"use strict";
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});
/* 入力は 
fAIR, LATER, OCCASIONALLY CLOUDY.
 */

var re = /\s+|$/;
reader.on('close', () => {
    var l = lines[0];
    
    console.log(aux(l));
});

function aux(l)
{
    var s="";
    for (var i=0; i<l.length; i++) {
	var c=l[i]
	s += swapCase(c)
    }
    return s;
}

var rs=/[a-z]/;
var rc=/[A-Z]/;
function swapCase(c)
{
    if (rs.test(c)) {
	return c.toUpperCase();
    } else if (rc.test(c)) {
	return c.toLowerCase();
    } else {
	return c;
    }
}
