using System.Collections.Generic;
using System.Text.RegularExpressions;
public static void Main()
String firstVector = Console.ReadLine();
String secondVector = Console.ReadLine();
if (ValidateOnIncorrectSymbol(firstVector, secondVector)) {
Console.WriteLine("Vector can\'t contain digits from decimal system");
var lists = CreateByteLists(firstVector, secondVector);
Console.WriteLine(String.Join(' ', lists.Item1));
public static Tuple<List<byte>, List<byte>> CreateByteLists(String firstVectorString, String secondVectorString) {
List<byte> firstVector = Encoding.ASCII.GetBytes(firstVectorString).ToList();
List<byte> secondVector = Encoding.ASCII.GetBytes(secondVectorString).ToList();
Int32 lengthDifferent = firstVector.Count - secondVector.Count;
if (lengthDifferent != 0) {
List<byte> lowerVector = lengthDifferent > 0 ? secondVector : firstVector;
lowerVector.AddRange(new Byte[Math.Abs(lengthDifferent)]);
for(Int32 i = 0; i < firstVector.Count; ++i) {
if ((firstVector[i] | secondVector[i]) == 0) {
secondVector.RemoveAt(i);
return new Tuple<List<byte>, List<byte>>(firstVector, secondVector);
public static Boolean ValidateOnIncorrectSymbol(String firstVectorString, String secondVectorString) {
String[] vectors = { firstVectorString, secondVectorString };
const String regExp = "^[0-1]*$";
Regex regex = new Regex(regExp);
return vectors.Any(v => !regex.IsMatch(v));