CodeForces 131A

#include
#include
#include
#include
using namespace std;
char String[110];
int Count,Length;
int main()
{
    while(scanf("%s",String) != EOF)
    {
        Count = 0;
        Length = strlen(String);
        for(int i = 1; i < Length; i++)
            if(isupper(String[i]))
                ++Count;
        if(isupper(String[0]) && (Count == (Length - 1)))
        {
            for(int i = 0; i < Length; i++)
                String[i] = tolower(String[i]);
        }

        else
        {
            if(islower(String[0]) && (Count == (Length - 1)))
            {
                String[0] = toupper(String[0]);
                for(int i = 1; i < Length; i++)
                    String[i] = tolower(String[i]);
            }
        }
        for(int i = 0; i < Length; i++)
            printf("%c",String[i]);
        printf("\n");
        //printf("%d %d\n",Count,Length);
    }
    return 0;
}

你可能感兴趣的:(生命之源)