天天看點

NBUT1117 .....

#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

int main()
{
    char ch;
    int t = 0;
    string str1, str2, str3, str4;
    while(scanf("%c", &ch)!=EOF)
    {
        if(ch=='-')
        {
            t++;
            if(t==2)
            {
                if(str1 == str3) cout << "SAME" << endl;
                else if(str2 == str4) cout << "SIMILAR" << endl;
                else cout << "DIFFERENT" << endl;
                str1.clear();
                str2.clear();
                str3.clear();
                str4.clear();
                t = 0;
            }
            continue;
        }
        if(t==0)
        {
            if(ch == ' ') str1 += ch;
            else if(ch == '\n') str1 += ch;
            else if(ch == '\r') str1 += ch;
            else if(ch == '\t') str1 += ch;
            else str1 += ch, str2 += ch;
        }
        else if(t==1)
        {
            if(ch == ' ') str3 += ch;
            else if(ch == '\n') str3 += ch;
            else if(ch == '\r') str3 += ch;
            else if(ch == '\t') str3 += ch;
            else str3 += ch, str4 += ch;
        }
    }
}