2014年1月17日 星期五

Codeforces Round #224 (Div. 2) A - Ksenia and Pan Scales


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
char a[1000005],b[1000005];
int main(){
    int i,j,l;
    string x,y;
    scanf("%s%s",a,b);
    l=strlen(a);
    for(i=0;i<l;i++){
        if(a[i]=='|')
            break;
        x+=a[i];
    }
    i++;
    for(;i<l;i++)
        y+=a[i];
    for(i=0;b[i];i++)
        if(x.length()<=y.length())
            x+=b[i];
        else y+=b[i];
    if(x.length()!=y.length()) puts("Impossible");
    else printf("%s|%s\n",x.c_str(),y.c_str());
}

沒有留言:

張貼留言