const lines = require('fs') .readFileSync('/dev/stdin', 'utf-8') .trim().split('\n').values(); let S = lines.next().value; S = [...S]; for (let i = 0; i < S.length; i++) { if (S[i].charCodeAt(0) < 'a') { S[i] = S[i].toLowerCase(); } else { S[i] = S[i].toUpperCase(); } } console.log(S.join(''));