#include <bits/stdc++.h>
using namespace std;
int main(){
	char a[1000];
	gets(a);
	int i;
	if(a[0]>='A'&&a[0]<='Z')
		cout<<char(a[0]+32);
	else
		cout<<char(a[0]-32);
	for(i=1;i<=strlen(a);i++){
		if(a[i]==' ')
			if(a[i+1]>='A'&&a[i+1]<='Z')
				cout<<char(a[i+1]+32);
			else
				cout<<char(a[i+1]-32);
	}
	
	return 0;
	}

/**************************************************************
	Problem: 1100
	User: fzy001
	Language: C++
	Result: Wrong Answer
****************************************************************/