s = gets.chomp

def small_letter?(c)
  c.ord >= 97 && c.ord <= 122
end

def big_letter?(c)
  c.ord >= 65 && c.ord <= 90
end

a = s.chars.map do |c|
  case
  when small_letter?(c) then c.upcase
  when big_letter?(c) then c.downcase
  else c
  end
end

puts a.join