using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string textBox1 = Console.ReadLine();
            string textBox2 = Console.ReadLine();
            int max = textBox1.Length;
            int valor = 0, valorTemp = 0;
            for (int i = 0; i < textBox1.Length; i++)
            {
                if (textBox1[i] == textBox2[0])
                {
                    valorTemp = moduloDeCadenaMasLarga(i + 1,textBox1,textBox2);
                    if (valorTemp > valor)
                    {
                        valor = valorTemp;
                    }
                }
            }

            Console.WriteLine(valor);
        }

        private static int moduloDeCadenaMasLarga(int inicio, string textBox1, string textBox2)
        {
            int longitud = 0;
            int contadorSubcadena = 1;
            int longitudDerecha = 0;
            int inicioIntermedio = inicio;
            int finIntermedio = 0;
            int longitudIntermedio = 0;
            int longitudIntermedioTemp = 0;
            for (int i = inicio; i < textBox1.Text.Length; i++)
            {
                if (textBox1.Text[i] == textBox2.Text[contadorSubcadena])
                {
                    finIntermedio = i - 1;
                    longitudIntermedioTemp = finIntermedio - inicioIntermedio;
                    if (longitudIntermedioTemp > longitudIntermedio)
                    {
                        longitudIntermedio = longitudIntermedioTemp;
                    }
                    inicioIntermedio = i;
                    contadorSubcadena++;
                }
                if (contadorSubcadena == textBox2.Text.Length)
                {
                    longitudDerecha = (textBox1.Text.Length - 1) - i;
                    break;
                }
            }
            if (contadorSubcadena == textBox2.Text.Length)
            {
                if (longitudDerecha > (inicio - 1) && longitudDerecha > longitudIntermedio)
                {
                    longitud = longitudDerecha;
                }
                else if (longitudIntermedio > (inicio - 1))
                {
                    longitud = longitudIntermedio;
                }
                else
                {
                    longitud = inicio - 1;
                }
            }
            return longitud;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        private static string filename = "input.txt";
        private static string output = "output.txt";
        static void Main(string[] args)
        {
            string strNumberF = string.Empty;
            string strNumberS = string.Empty;

            using (Stream str=File.OpenRead(filename))
            {
                using (StreamReader streamReader=new StreamReader(str))
                {
                    strNumberF = streamReader.ReadLine();
                    strNumberS = streamReader.ReadLine();
                }
            }

            int[] numbersF=new int[strNumberF.Length];
            int[] numbersS = new int[strNumberS.Length];
            for (int i = 0; i < strNumberF.Length; i++)
            {
                numbersF[i] = strNumberF[i] - 48;
                numbersS[i] = strNumberS[i] - 48;
            }

            using (Stream str = File.Open(output, FileMode.OpenOrCreate))
            {
                for(int i=0;i<numbersF.Length;i++)
                    if(numbersF[i]==numbersS[i])
                        str.WriteByte(48);
                    else
                        str.WriteByte(49);
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Graph
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            double[] ar = new double[4];
            for (int i = 0; i < 4; i++)
            {
                ar[i] = double.Parse(str[i]);
            }

            if (ar[1] - ar[0] == ar[2] - ar[1] && ar[2] - ar[1] == ar[3] - ar[2])
            {
                Console.WriteLine(ar[3] + (ar[1] - ar[0]));
                return;
            }

            if (ar[0] != 0 && ar[1] != 0 && ar[2] != 0 && ar[3] != 0)
            {
                if (ar[1] / ar[0] == ar[2] / ar[1] && ar[2] / ar[1] == ar[3] / ar[2])
                {
                    Console.WriteLine(ar[3] * (ar[1] / ar[0]));
                    return;
                }
            }

            Console.WriteLine(42);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeForces
{
    class R191_Test8_A
    {
        static void Main(string[] args)
        {
            int n = 4;
            string[] s = Console.ReadLine().Split();
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = int.Parse(s[i]);

            if (a[3] - a[2] == a[2] - a[1]
             && a[2] - a[1] == a[1] - a[0])
            {
                int d = a[1] - a[0];
                Console.WriteLine(a[3] + d);
                return;
            }

            if (a[3] * a[1] == a[2] * a[2]
             && a[2] * a[0] == a[1] * a[1])
            {
                Console.WriteLine(a[3] * a[3] / (double)a[2]);
                return;
            }

            Console.WriteLine(42);
        }
    }
}


/*
 * File:    main.cs
 * Author:  Hrayr [HarHro94]
 * Problem: codeforces
 * IDE:     Visual C# 2010
 */
using System;
using System.Text;
using System.IO;
using System.Collections.Generic;

namespace Spoj
{
    public static class program
    {
        static List<int> Bin(long n)
        {
            List<int> ret = new List<int>();
            while (n>0)
            {
                ret.Add((int)n&1);
                n /= 2;
            }
            ret.Reverse();
            return ret;
        }

        static int Main(string[] args)
        {
            string[] tmp = Console.ReadLine().Split(' ');
            long a = long.Parse(tmp[0]);
            long b = long.Parse(tmp[1]);
            List<int> A = Bin(a);
            List<int> B = Bin(b);
            if (A.Count != B.Count)
            {
                Console.WriteLine(((long)(1) << B.Count) - 1);
                return 0;
            }
            if (a == b)
            {
                Console.WriteLine(a ^ a);
            }
            List<int> U = new List<int>();
            List<int> V = new List<int>();
            bool uLess = false;
            bool vGreater = false;
            int i = 0;
            while (A[i] == B[i])
            {
                ++i;
                U.Add(A[i]);
                V.Add(A[i]);
            }
            U.Add(A[i]);
            V.Add(B[i]);
            ++i;
            while (i != A.Count)
            {
                if (A[i] + B[i] == 1)
                {
                    U.Add(A[i]);
                    V.Add(B[i]);
                }
                else
                {
                    if (A[i] == 1)
                    {
                        U.Add(0);
                        V.Add(1);
                        uLess = true;
                    }
                    else
                    {
                        U.Add(0);
                        V.Add(1);
                        vGreater = true;
                    }
                }
                ++i;
            }
            long res = 0;
            for (i = 0; i < U.Count; ++i)
            {
                U[i] = (U[i] + V[i]) % 2;
                res = 2 * res + U[i];
            }
            Console.WriteLine(res);
            return 0;
        }
    }
}


// Just split the path string and apply the changes.

using System;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        long x1 = 0, y1 = 0, x2 = 0, y2 = 0, x3 = 0, y3 = 0;
        string buf = Console.ReadLine();
        string[] vals = buf.Split(' ');
        x1 = Convert.ToInt32(vals[0]);
        y1 = Convert.ToInt32(vals[1]);

        buf = Console.ReadLine();
        vals = buf.Split(' ');
        x2 = Convert.ToInt32(vals[0]);
        y2 = Convert.ToInt32(vals[1]);

        buf = Console.ReadLine();
        vals = buf.Split(' ');
        x3 = Convert.ToInt32(vals[0]);
        y3 = Convert.ToInt32(vals[1]);

        int crs = (x2-x1)*(y3-y2)-(y2-y1)*(x3-x2);
        if(crs == 0) {
            Console.WriteLine("TOWARDS");
        }
        else if(crs < 0) {
            Console.WriteLine("RIGHT");
        }
        else if(crs > 0) {
            Console.WriteLine("LEFT");
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Kirill_And_The_Game
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), Double.Parse);
            Int64 l = Convert.ToInt64(arr[0]);
            Int64 r = Convert.ToInt64(arr[1]);
            Int64 x = Convert.ToInt64(arr[2]);
            Int64 y = Convert.ToInt64(arr[3]);
            double k = arr[4];
            bool cond = false;

            for(Int64 a = l; a<r+1; a++ )
            {
                for(Int64 b = x; b<y+1; b++)
                {
                    if(k == a / b)
                    {
                        cond = true;
                        break;
                    }
                }
                if (cond) break;

            }
            if(cond)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");

        }
    }
}


//#define TESTCASES
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;

namespace HackerEarth
{
    /// <summary>
    /// Solution class
    /// </summary>
    internal static class Program
    {
        #region Main
        /// <summary>
        /// Modulo operator used in a lot of questions
        /// </summary>
        private const long mod = 1000000007L;

        /// <summary>
        /// Fast Console IO helper
        /// </summary>
        private static ConsoleHelper Console { get; } = new ConsoleHelper();

        /// <summary>
        /// Main method - Launches solver
        /// </summary>
        private static void Main()
        {
            using (Console)
            {
#if DEBUG
                Stopwatch timer = Stopwatch.StartNew();
#endif

#if TESTCASES
                TestCases();
#else //!TESTCASES
                Solve();
#endif
#if DEBUG
                timer.Stop();
                Console.Write($"\r\nTotal run time: {timer.Elapsed.TotalSeconds:0.000}s");
#endif
            }
        }

#if TESTCASES
        /// <summary>
        /// Solves the problem for multiple test cases
        /// </summary>
        private static void TestCases()
        {
            int t = Console.NextInt();
            Console.SkipNextLine();

            while (t-- > 0)
            {
                Solve();
            }
        }

#endif
        #endregion

        #region Solution

        /// <summary>
        /// Solution
        /// </summary>
        private static void Solve()
        {

            int l=Console.NextInt();
            int r=Console.NextInt();
			int x=Console.NextInt();
			int y=Console.NextInt();
            int k=Console.NextInt();
			int t=0;
         while(x<=y)
		 {
		 int mid=x+(y-x)/2;
		 if(mid*k>r)
		 y=mid-1;
		 if(mid*x<l)
		 x=mid+1;
		 else
		 {
		 t=1;
		 break;
		 }
		 if(t==0)
		 Console.WriteLine("NO");
		 else
		 Consoel.WriteLine("YES");

		 }

        }
        #endregion
    }

    #region Tools
    //Solution does not extend beyond this point, those are merely tools to help along
    /// <summary>
    /// Fast Console IO helper
    /// </summary>
    [DebuggerStepThrough]
    internal sealed class ConsoleHelper : IDisposable
    {
        #region Constants
        /// <summary>
        /// The standard input and output buffers size (2^20, 1Mb)
        /// </summary>
        private const int baseSize = 1048576;
        /// <summary>
        /// Integer out string conversion buffer
        /// </summary>
        private static readonly char[] numBuffer = new char[20];
        #endregion

        #region Fields
        private readonly BufferedStream inStream; //Buffered console input stream
        private readonly StreamWriter outStream; //Buffered console output stream

        private readonly byte[] inBuffer; //Input buffer
        private int inputIndex; //Input buffer current index
        private int bufferEnd; //Input buffer ending index
        #endregion

        #region Properties
        /// <summary>
        /// The buffer size, in bytes
        /// </summary>
        public int BufferSize { get; }

        /// <summary>
        /// If this memory stream is open and available to read/write
        /// </summary>
        public bool Open { get; private set; }
        #endregion

        #region Constructors
        /// <summary>
        /// Creates a new console IO helper reading from the standard Console input and output
        /// </summary>
        public ConsoleHelper() : this(baseSize) { }

        /// <summary>
        /// Creates a new console IO helper reading from the standard Console input and output with the specified buffer size
        /// <param name="bufferSize">Size of the buffer to use in bytes</param>
        /// </summary>
        public ConsoleHelper(int bufferSize)
        {
            //Open the input/output streams
#if DEBUG
            //Test mode
            this.inStream = new BufferedStream(File.OpenRead(@"..\..\input.txt"), bufferSize);
            this.outStream = new StreamWriter(File.Create(@"..\..\output.txt", bufferSize), Encoding.ASCII, bufferSize);
#else //!DEBUG
//Submission mode
            this.inStream = new BufferedStream(Console.OpenStandardInput(bufferSize), bufferSize); //Submission stream
            this.outStream = new StreamWriter(Console.OpenStandardOutput(bufferSize), Encoding.ASCII, bufferSize);
#endif

            //Set fields
            this.inBuffer = new byte[bufferSize];
            this.inputIndex = this.bufferEnd = 0;
            this.BufferSize = bufferSize;
            this.Open = true;
        }
        #endregion

        #region Static methods
        /// <summary>
        /// Verifies that the passed character is a non-special ASCII character
        /// </summary>
        /// <param name="i">Character to validate</param>
        /// <returns>True if the character is not a special character</returns>
        public static bool ValidateChar(int i) => i >= ' ';

        /// <summary>
        /// Verifies that the passed character is a non-special ASCII character or a whitespace
        /// </summary>
        /// <param name="i">Character to validate</param>
        /// <returns>True if the character is not a whitespace or a special character</returns>
        public static bool ValidateCharNoSpace(int i) => i > ' ';

        /// <summary>
        /// Verifies that the passed character is a numerical character (0-9)
        /// </summary>
        /// <param name="i">Character to validate</param>
        /// <returns>True if the character is a numerical character, false otherwise</returns>
        public static bool ValidateNumber(int i) => i >= '0' && i <= '9';

        /// <summary>
        /// Verifies if a character is an Endline character
        /// </summary>
        /// <param name="i">Character to check</param>
        /// <returns>True if it is an Endline character, false otherwise</returns>
        public static bool IsEndline(int i) => i == '\n' || i == '\0';

        /// <summary>
        /// Takes a signed int value and copies it's characters at the end of the integer char buffer
        /// </summary>
        /// <param name="n">Int to write to the buffer</param>
        /// <returns>Head index at which the buffer's writing starts</returns>
        private static int GetIntBuffer(int n)
        {
            int head = 20;
            bool neg;
            if (n < 0)
            {
                neg = true;
                n = -n;
            }
            else { neg = false; }

            do
            {
                numBuffer[--head] = (char)((n % 10) + 48);
                n /= 10;
            }
            while (n > 0);

            if (neg) { numBuffer[--head] = '-'; }
            return head;
        }

        /// <summary>
        /// Takes a signed long value and copies it's characters at the end of the integer char buffer
        /// </summary>
        /// <param name="n">Long to write to the buffer</param>
        /// <returns>Head index at which the buffer's writing starts</returns>
        private static int GetLongBuffer(long n)
        {
            int head = 20;
            bool neg;
            if (n < 0L)
            {
                neg = true;
                n = -n;
            }
            else { neg = false; }

            do
            {
                numBuffer[--head] = (char)((n % 10L) + 48L);
                n /= 10L;
            }
            while (n > 0L);

            if (neg) { numBuffer[--head] = '-'; }
            return head;
        }
        #endregion

        #region Methods
        /// <summary>
        /// Returns the next byte data in the console input stream
        /// </summary>
        /// <returns>Next data byte from the console</returns>
        public byte Read()
        {
            CheckBuffer();
            return this.inBuffer[this.inputIndex++];
        }

        /// <summary>
        /// Returns the next byte data in the console input stream without consuming it
        /// </summary>
        /// <returns>Next data byte from the console</returns>
        public byte Peek()
        {
            CheckBuffer();
            return this.inBuffer[this.inputIndex];
        }

        /// <summary>
        /// Skips a number of characters in the input stream
        /// </summary>
        /// <param name="n">Amount of chars to skip, defaults to 1</param>
        public void Skip(int n = 1) => this.inputIndex += n;

        /// <summary>
        /// Assures we have data available in the input buffer
        /// </summary>
        private void CheckBuffer()
        {
            //If we reach the end of the buffer, load more data
            if (this.inputIndex >= this.bufferEnd)
            {
                this.inputIndex = this.inputIndex - this.bufferEnd;
                this.bufferEnd = this.inStream.Read(this.inBuffer, 0, this.BufferSize);

                //If nothing was added, add a null char at the start
                if (this.bufferEnd < 1) { this.inBuffer[this.bufferEnd++] = 0; }
            }
        }

        /// <summary>
        /// Returns the next character in the console input stream
        /// </summary>
        /// <returns>Next character in the input stream</returns>
        public char NextChar() => (char)Read();

        /// <summary>
        /// Returns the next string token from the console input
        /// </summary>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <returns>Parsed string, separated by spaces or special characters such as line feeds</returns>
        public string Next()
        {
            byte b = SkipInvalid();
            ValidateEndline(b);

            //Append all characters
            StringBuilder sb = new StringBuilder().Append((char)b);
            b = Peek();
            while (ValidateCharNoSpace(b))
            {
                //Peek to not consume terminator
                sb.Append((char)b);
                Skip();
                b = Peek();
            }

            return sb.ToString();
        }

        /// <summary>
        /// Returns the next int value in the console input, this is a fast parse
        /// </summary>
        /// <exception cref="FormatException">If the text is not a valid integer</exception>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <exception cref="OverflowException">If the value is too large for integer</exception>
        /// <returns>Parsed int value from the input</returns>
        public int NextInt()
        {
            //Skip invalids
            byte b = SkipInvalid();
            ValidateEndline(b);

            //Verify for negative
            bool neg = false;
            if (b == '-')
            {
                neg = true;
                b = Read();
            }

            //Get first digit
            if (!ValidateNumber(b)) { throw new FormatException("Integer parsing has failed because the string contained invalid characters"); }

            int n = b - '0';
            b = Peek();
            while (ValidateNumber(b))
            {
                //Peek to not consume terminator, and check for overflow
                n = checked((n << 3) + (n << 1) + (b - '0'));
                Skip();
                b = Peek();
            }
            //If the character causing the exit is a valid ASCII character, the integer isn't correct formatted
            if (ValidateCharNoSpace(b)) { throw new FormatException("Integer parsing has failed because the string contained invalid characters"); }

            return neg ? -n : n;
        }

        /// <summary>
        /// Returns the next long value in the console input, this is a fast parse
        /// </summary>
        /// <exception cref="FormatException">If the text is not a valid long</exception>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <exception cref="OverflowException">If the value is too large for long</exception>
        /// <returns>Parsed long value from the input</returns>
        public long NextLong()
        {
            byte b = SkipInvalid();
            ValidateEndline(b);

            //Verify negative
            bool neg = false;
            if (b == '-')
            {
                neg = true;
                b = Read();
            }

            //Get first digit
            if (!ValidateNumber(b)) { throw new FormatException("Integer parsing has failed because the string contained invalid characters"); }

            long n = b - '0';
            b = Peek();
            while (ValidateNumber(b))
            {
                //Peek to not consume terminator, and check for overflow
                n = checked((n << 3) + (n << 1) + (b - '0'));
                Skip();
                b = Peek();
            }
            //If the character causing the exit is a valid ASCII character, the long isn't correct formatted
            if (ValidateCharNoSpace(b)) { throw new FormatException("Long parsing has failed because the string contained invalid characters"); }

            return neg ? -n : n;
        }

        /// <summary>
        /// Returns the next double value in the console input
        /// Note: fast double parsing is slightly harder, I'll implement it if I need to
        /// </summary>
        /// <exception cref="FormatException">If the text is not a valid double</exception>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <exception cref="OverflowException">If the value is too large for double</exception>
        /// <returns>Parsed double value from the input</returns>
        public double NextDouble() => double.Parse(Next());

        /// <summary>
        /// Returns the next n int values on the same line in an array
        /// </summary>
        /// <param name="n">Number of values to seek</param>
        /// <exception cref="FormatException">If the text is not a valid integer</exception>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <exception cref="OverflowException">If the value is too large for integer</exception>
        /// <exception cref="OutOfMemoryException">If the created array is too large for the system memory</exception>
        /// <returns>The n integer values in an array</returns>
        public int[] NextInts(int n)
        {
            int[] array = new int[n];
            for (int i = 0; i < n; i++)
            {
                array[i] = NextInt();
            }

            SkipNextLine();
            return array;
        }

        /// <summary>
        /// Returns the next n long values on the same line in an array
        /// </summary>
        /// <param name="n">Number of values to seek</param>
        /// <exception cref="FormatException">If the text is not a valid long</exception>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <exception cref="OverflowException">If the value is too large for long</exception>
        /// <exception cref="OutOfMemoryException">If the created array is too large for the system memory</exception>
        /// <returns>The n long values in an array</returns>
        public long[] NextLongs(int n)
        {
            long[] array = new long[n];
            for (int i = 0; i < n; i++)
            {
                array[i] = NextLong();
            }

            SkipNextLine();
            return array;
        }

        /// <summary>
        /// Returns the next n int values on the next m lines in the output stream under the form of an NxM matrix
        /// </summary>
        /// <param name="n">Number of rows to the matrix</param>
        /// <param name="m">Number of columns to the matrix</param>
        /// <exception cref="FormatException">If the text is not a valid integer</exception>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <exception cref="OverflowException">If the value is too large for integer</exception>
        /// <exception cref="OutOfMemoryException">If the created 2D array is too large for the system memory</exception>
        /// <returns>The NxM matrix of integers</returns>
        public int[,] NextMatrix(int n, int m)
        {
            int[,] matrix = new int[n, m];
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    matrix[i, j] = NextInt();
                }

                SkipNextLine();
            }

            return matrix;
        }

        /// <summary>
        /// Returns the next line of text in the console
        /// </summary>
        /// <returns>Next string line from the console</returns>
        public string NextLine()
        {
            byte b = SkipInvalid();
            if (b == 0)
            {
                //Consume newline and return empty string
                Skip();
                return string.Empty;
            }

            //Read all the characters until the next linefeed
            StringBuilder sb = new StringBuilder().Append((char)b);
            b = Read();
            while (!IsEndline(b))
            {
                //Don't append special characters, but don't exit
                if (ValidateChar(b))
                {
                    sb.Append((char)b);
                }
                b = Read();
            }

            return sb.ToString();
        }

        /// <summary>
        /// Skips the next token in input
        /// </summary>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        public void SkipNext()
        {
            byte b = SkipInvalid();
            ValidateEndline(b);

            for (b = Peek(); ValidateCharNoSpace(b); b = Peek())
            {
                Skip();
            }
        }

        /// <summary>
        /// Skips all the text on the current line and jump to the next
        /// </summary>
        public void SkipNextLine()
        {
            for (byte b = Read(); !IsEndline(b); b = Read()) { }
        }

        /// <summary>
        /// Enumerates the given number of integers on the current line
        /// </summary>
        /// <param name="n">Number of integers on the current line</param>
        /// <returns>Enumerable of the integers</returns>
        public IEnumerable<int> EnumerateInts(int n)
        {
            while (n-- > 0)
            {
                yield return NextInt();
            }

            SkipNextLine();
        }

        /// <summary>
        /// Enumerates all the characters in the next line until the feed is exhausted or an endline character is met
        /// </summary>
        /// <returns>Enumerable of all the characters in the current line</returns>
        public IEnumerable<char> EnumerateLine()
        {
            for (char c = NextChar(); !IsEndline(c); c = NextChar())
            {
                if (ValidateChar(c))
                {
                    yield return c;
                }
            }
        }

        /// <summary>
        /// Assures we are not trying to read more data on the line that there exists
        /// </summary>
        /// <param name="b">Byte data to verify</param>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        private void ValidateEndline(byte b)
        {
            //If empty char
            if (b == 0)
            {
                //Go back a char and throw
                this.inputIndex--;
                throw new InvalidOperationException("No values left on line");
            }
        }

        /// <summary>
        /// Skips all invalid character bytes then returns the first valid byte found, spaces are considered invalid
        /// </summary>
        /// <returns>The next valid character byte, cannot be a whitespace</returns>
        private byte SkipInvalid()
        {
            byte b = Peek();
            if (IsEndline(b)) { return 0; }

            while (!ValidateCharNoSpace(b))
            {
                Skip();
                b = Peek();
                //Return empty char if we meet an linefeed or empty char
                if (IsEndline(b)) { return 0; }
            }

            return Read();
        }

        /// <summary>
        /// Writes the given char to the console output
        /// </summary>
        /// <param name="c">Character to write</param>
        public void Write(char c) => this.outStream.Write(c);

        /// <summary>
        /// Writes the given char buffer to the console output
        /// </summary>
        /// <param name="buffer">Char buffer to write</param>
        public void Write(char[] buffer) => this.outStream.Write(buffer);

        /// <summary>
        /// Writes the given string to the console output
        /// </summary>
        /// <param name="s">String to write</param>
        public void Write(string s) => this.outStream.Write(s);

        /// <summary>
        /// Writes the given integer to the console output
        /// </summary>
        /// <param name="n">Integer to write</param>
        public void Write(int n)
        {
            int head = GetIntBuffer(n);
            this.outStream.Write(numBuffer, head, 20 - head);
        }

        /// <summary>
        /// Writes the given long to the console output
        /// </summary>
        /// <param name="n">Long to write</param>
        public void Write(long n)
        {
            int head = GetLongBuffer(n);
            this.outStream.Write(numBuffer, head, 20 - head);
        }

        /// <summary>
        /// Writes the contents of the StringBuilder to the console output
        /// </summary>
        /// <param name="sb">StringBuilder to write to the output</param>
        public void Write(StringBuilder sb) => this.outStream.Write(sb.ToCharArray());

        /// <summary>
        /// Writes the given object to the console output using the object's ToString method
        /// </summary>
        /// <param name="o">Object to write</param>
        public void Write(object o) => this.outStream.Write(o);

        /// <summary>
        /// Writes a sequence to the console output with the given string separator
        /// </summary>
        /// <typeparam name="T">Type of elements in the sequence</typeparam>
        /// <param name="e">Sequence to print</param>
        /// <param name="separator">String separator between each element, defaults to the empty string</param>
        public void Write<T>(IEnumerable<T> e, string separator = "") => this.outStream.Write(new StringBuilder().AppendJoin(e, separator).ToCharArray());

        /// <summary>
        /// Writes a sequence to the console output with the given string separator
        /// </summary>
        /// <typeparam name="T">Type of elements in the sequence</typeparam>
        /// <param name="e">Sequence to print</param>
        /// <param name="separator">Character separator between each element</param>
        public void Write<T>(IEnumerable<T> e, char separator) => this.outStream.Write(new StringBuilder().AppendJoin(e, separator).ToCharArray());

        /// <summary>
        /// Writes a linefeed to the console output
        /// </summary>
        public void WriteLine() => this.outStream.WriteLine();

        /// <summary>
        /// Writes the given char to the console output, followed by a linefeed
        /// </summary>
        /// <param name="c">Character to write</param>
        public void WriteLine(char c) => this.outStream.WriteLine(c);

        /// <summary>
        /// Writes the given char buffer to the console output, followed by a linefeed
        /// </summary>
        /// <param name="buffer">Char buffer to write to the output</param>
        public void WriteLine(char[] buffer) => this.outStream.WriteLine(buffer);

        /// <summary>
        /// Writes the given string to the console output, followed by a linefeed
        /// </summary>
        /// <param name="s">String to write</param>
        public void WriteLine(string s) => this.outStream.WriteLine(s);

        /// <summary>
        /// Writes the given integer to the console output, followed by a linefeed
        /// </summary>
        /// <param name="n">Integer to write</param>
        public void WriteLine(int n)
        {
            int head = GetIntBuffer(n);
            this.outStream.WriteLine(numBuffer, head, 20 - head);
        }

        /// <summary>
        /// Writes the given long to the console output, followed by a linefeed
        /// </summary>
        /// <param name="n">Long to write</param>
        public void WriteLine(long n)
        {
            int head = GetLongBuffer(n);
            this.outStream.WriteLine(numBuffer, head, 20 - head);
        }

        /// <summary>
        /// Writes the contents of the StringBuilder to the console output, followed by a linefeed
        /// </summary>
        /// <param name="sb">StringBuilder to write to the output</param>
        public void WriteLine(StringBuilder sb) => this.outStream.WriteLine(sb.ToCharArray());

        /// <summary>
        /// Writes a sequence to the console output with the given string separator, follows by a linefeed
        /// </summary>
        /// <typeparam name="T">Type of elements in the sequence</typeparam>
        /// <param name="e">Sequence to print</param>
        /// <param name="separator">String separator between each element, defaults to the empty string</param>
        public void WriteLine<T>(IEnumerable<T> e, string separator = "") => this.outStream.WriteLine(new StringBuilder().AppendJoin(e, separator).ToCharArray());

        /// <summary>
        /// Writes a sequence to the console output with the given string separator, follows by a linefeed
        /// </summary>
        /// <typeparam name="T">Type of elements in the sequence</typeparam>
        /// <param name="e">Sequence to print</param>
        /// <param name="separator">Character separator between each element</param>
        public void WriteLine<T>(IEnumerable<T> e, char separator) => this.outStream.WriteLine(new StringBuilder().AppendJoin(e, separator).ToCharArray());

        /// <summary>
        /// Writes the given object to the console output using the object's ToString method, followed by a linefeed
        /// </summary>
        /// <param name="o">Object to write</param>
        public void WriteLine(object o) => this.outStream.WriteLine(o);

        /// <summary>
        /// Flushes the output buffer to the console if the buffer is full, or if it's being forced
        /// </summary>
        public void Flush() => this.outStream.Flush();

        /// <summary>
        /// Disposes of the resources of this ConsoleHelper, closing all the associated streams
        /// </summary>
        public void Dispose()
        {
            if (this.Open)
            {
                Flush();
                this.inStream.Dispose();
                this.outStream.Dispose();
                this.Open = false;
            }
        }
        #endregion
    }

    /// <summary>
    /// Useful extensions
    /// </summary>
    internal static class Extensions
    {
        #region Enumerable extensions
        /// <summary>
        /// Applies an action on each member of the enumerable
        /// </summary>
        /// <typeparam name="T">Type of elements in the Enumerable</typeparam>
        /// <param name="e">Enumerable to loop through</param>
        /// <param name="action">Action to apply to each parameter</param>
        public static void ForEach<T>(this IEnumerable<T> e, Action<T> action)
        {
            foreach (T t in e)
            {
                action(t);
            }
        }

        /// <summary>
        /// Joins all the elements of the enumerable into a string
        /// </summary>
        /// <typeparam name="T">Type of elements in the Enumerable</typeparam>
        /// <param name="e">Enumerable to loop through</param>
        /// <param name="separator">Separator string, defaults to the empty string</param>
        public static string Join<T>(this IEnumerable<T> e, string separator = "") => new StringBuilder().AppendJoin(e, separator).ToString();

        /// <summary>
        /// Joins all the elements of the enumerable into a string
        /// </summary>
        /// <typeparam name="T">Type of elements in the Enumerable</typeparam>
        /// <param name="e">Enumerable to loop through</param>
        /// <param name="separator">Separator character</param>
        public static string Join<T>(this IEnumerable<T> e, char separator) => new StringBuilder().AppendJoin(e, separator).ToString();

        /// <summary>
        /// Finds the object with the maximum value in the enumerable
        /// </summary>
        /// <typeparam name="T">Type of objects in the Enumerable</typeparam>
        /// <typeparam name="TU">Comparing type, must implement IComparable(T)</typeparam>
        /// <param name="e">Enumerable to loop through</param>
        /// <param name="selector">Function calculating the value that we want the max from</param>
        /// <returns>The object with the maximum value in the enumerable</returns>
        public static T MaxValue<T, TU>(this IEnumerable<T> e, Func<T, TU> selector) where TU : IComparable<TU>
        {
            using (IEnumerator<T> enumerator = e.GetEnumerator())
            {
                if (!enumerator.MoveNext()) { throw new InvalidOperationException("No elements in sequence"); }

                T max = enumerator.Current;
                TU value = selector(max);
                while (enumerator.MoveNext())
                {
                    TU v = selector(enumerator.Current);
                    if (value.CompareTo(v) < 0)
                    {
                        max = enumerator.Current;
                        value = v;
                    }
                }

                return max;
            }
        }

        /// <summary>
        /// Finds the object with the minimum value in the enumerable
        /// </summary>
        /// <typeparam name="T">Type of objects in the Enumerable</typeparam>
        /// <typeparam name="TU">Comparing type, must implement IComparable(T)</typeparam>
        /// <param name="e">Enumerable to loop through</param>
        /// <param name="selector">Function calculating the value that we want the min from</param>
        /// <returns>The object with the minimum value in the enumerable</returns>
        public static T MinValue<T, TU>(this IEnumerable<T> e, Func<T, TU> selector) where TU : IComparable<TU>
        {
            using (IEnumerator<T> enumerator = e.GetEnumerator())
            {
                if (!enumerator.MoveNext()) { throw new InvalidOperationException("No elements in sequence"); }

                T min = enumerator.Current;
                TU value = selector(min);
                while (enumerator.MoveNext())
                {
                    TU v = selector(enumerator.Current);
                    if (value.CompareTo(v) > 0)
                    {
                        min = enumerator.Current;
                        value = v;
                    }
                }

                return min;
            }
        }
        #endregion

        #region String extensions
        /// <summary>
        /// Appends multiple objects to a StringBuilder, separated by the given string
        /// </summary>
        /// <typeparam name="T">Type of elements in the Enumerable</typeparam>
        /// <param name="sb">StringBuilder to append to</param>
        /// <param name="source">Enumerable to loop through</param>
        /// <param name="separator">Separator string, defaults to the empty string</param>
        /// <returns>The StringBuilder instance after the appending is done</returns>
        public static StringBuilder AppendJoin<T>(this StringBuilder sb, IEnumerable<T> source, string separator = "")
        {
            using (IEnumerator<T> e = source.GetEnumerator())
            {
                if (e.MoveNext())
                {
                    sb.Append(e.Current);
                    while (e.MoveNext())
                    {
                        sb.Append(separator).Append(e.Current);
                    }
                }
            }

            return sb;
        }

        /// <summary>
        /// Appends multiple objects to a StringBuilder, separated by the given string
        /// </summary>
        /// <typeparam name="T">Type of elements in the Enumerable</typeparam>
        /// <param name="sb">StringBuilder to append to</param>
        /// <param name="source">Enumerable to loop through</param>
        /// <param name="separator">Separator character</param>
        /// <returns>The StringBuilder instance after the appending is done</returns>
        public static StringBuilder AppendJoin<T>(this StringBuilder sb, IEnumerable<T> source, char separator)
        {
            using (IEnumerator<T> e = source.GetEnumerator())
            {
                if (e.MoveNext())
                {
                    sb.Append(e.Current);
                    while (e.MoveNext())
                    {
                        sb.Append(separator).Append(e.Current);
                    }
                }
            }

            return sb;
        }

        /// <summary>
        /// Returns true if the string is null, or the empty string ""
        /// Note: this will never throw a NullRef exception given that it is an extension method calling a static method
        /// </summary>
        /// <param name="s">String to test</param>
        /// <returns>True if the string is null or empty, false otherwise</returns>
        public static bool IsEmpty(this string s) => string.IsNullOrEmpty(s);

        /// <summary>
        /// Creates a substring from a starting and ending index
        /// </summary>
        /// <param name="s">String to substring</param>
        /// <param name="start">Starting index</param>
        /// <param name="end">Ending index</param>
        /// <returns>The resulting substring</returns>
        public static string SubStr(this string s, int start, int end) => s.Substring(start, (end - start) + 1);

        /// <summary>
        /// Copies the contents of a StringBuilder instance to an array
        /// </summary>
        /// <param name="sb">StringBuilder to copy</param>
        /// <returns>Contents array of the StringBuilder</returns>
        public static char[] ToCharArray(this StringBuilder sb)
        {
            char[] buffer = new char[sb.Length];
            sb.CopyTo(0, buffer, 0, sb.Length);
            return buffer;
        }
        #endregion

        #region Number extensions
        /// <summary>
        /// Tests if the given number is even or not
        /// </summary>
        /// <param name="n">Number to test</param>
        /// <returns>True if the number is pair, false otherwise</returns>
        public static bool IsEven(this int n) => (n & 1) == 0;

        /// <summary>
        /// Tests if the given number is Even or not
        /// </summary>
        /// <param name="n">Number to test</param>
        /// <returns>True if the number is pair, false otherwise</returns>
        public static bool IsEven(this long n) => (n & 1L) == 0;

        /// <summary>
        /// Real Modulus function over the integer, not a remainder function like the normal C# mod
        /// </summary>
        /// <param name="n">Left operand of the mod</param>
        /// <param name="m">Right operand of the mod</param>
        /// <returns>The Modulus of n and m, within [0, m - 1]</returns>
        public static int Mod(this int n, int m) => ((n % m) + m) % m;

        /// <summary>
        /// Real Modulus function over the integer, not a remainder function like the normal C# mod
        /// </summary>
        /// <param name="n">Left operand of the mod</param>
        /// <param name="m">Right operand of the mod</param>
        /// <returns>The Modulus of n and m, within [0, m - 1]</returns>
        public static long Mod(this long n, long m) => ((n % m) + m) % m;

        /// <summary>
        /// Counts the amount of set bits (1s in the binary representation) of a given integer
        /// </summary>
        /// <param name="n">Integer to get the set bits from</param>
        /// <returns>Amount of set bits of the integer</returns>
        public static int SetBits(this int n)
        {
            n = n - ((n >> 1) & 0x55555555);
            n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
            return (((n + (n >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
        }

        /// <summary>
        /// Counts the amount of set bits (1s in the binary representation) of a given long
        /// </summary>
        /// <param name="n">Long to get the set bits from</param>
        /// <returns>Amount of set bits of the long</returns>
        public static long SetBits(this long n)
        {
            n = n - ((n >> 1) & 0x5555555555555555);
            n = (n & 0x3333333333333333) + ((n >> 2) & 0x3333333333333333);
            return (((n + (n >> 4)) & 0xF0F0F0F0F0F0F0F) * 0x101010101010101) >> 56;
        }
        #endregion

        #region Array extensions
        /// <summary>
        /// Does a binary search through the sorted array to find the requested value
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="value">Value to find</param>
        /// <returns>The index of the found element, or -1 if it wasn't found</returns>
        public static int BinarySearch<T>(this T[] array, T value) => Array.BinarySearch(array, value);

        /// <summary>
        /// Clears the array of all elements
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to clear</param>
        public static void Clear<T>(this T[] array) => Array.Clear(array, 0, array.Length);

        /// <summary>
        /// Determines if the array contains the given value
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="value">Value to find</param>
        /// <returns>True if the value was found, false otherwise</returns>
        public static bool Contains<T>(this T[] array, T value) => Array.IndexOf(array, value) != -1;

        /// <summary>
        /// Enumerates the contents of an ArraySegment
        /// </summary>
        /// <typeparam name="T">Type contained within the array</typeparam>
        /// <param name="array">Array to iterate through</param>
        /// <param name="offset">Index offset to start the iteration at, defaults to 0</param>
        /// <param name="count">Amount of values to return, default to the whole array</param>
        /// <returns>Enumerable of all the values contained in the ArraySegment</returns>
        public static IEnumerable<T> Enumerate<T>(this T[] array, int offset = 0, int count = 0)
        {
            if (count == 0) { count = array.Length - offset; }

            int max = offset + count;
            for (int i = offset; i < max; i++)
            {
                yield return array[i];
            }
        }

        /// <summary>
        /// Sees if an elements matching the specified condition exists in the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="match">Matching function to apply</param>
        /// <returns>True if a matching element exists, false otherwise</returns>
        public static bool Exists<T>(this T[] array, Predicate<T> match) => Array.Exists(array, match);

        /// <summary>
        /// Finds the first element matching the given condition in the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="match">Matching function to apply</param>
        /// <returns>The first found element that satisfied the match, or default(T) if none did</returns>
        public static T Find<T>(this T[] array, Predicate<T> match) => Array.Find(array, match);

        /// <summary>
        /// Finds the last element matching the given condition in the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="match">Matching function to apply</param>
        /// <returns>The last found element that satisfied the match, or default(T) if none did</returns>
        public static T FindLast<T>(this T[] array, Predicate<T> match) => Array.FindLast(array, match);

        /// <summary>
        /// Applies an action to every member of the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to loop through</param>
        /// <param name="action">Action to apply on each member</param>
        public static void ForEach<T>(this T[] array, Action<T> action) => Array.ForEach(array, action);

        /// <summary>
        /// Generates all the subsets of the given array of a size greater than or equal 1
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to get the subsets from</param>
        /// <returns>All the subsets of size 1 or greater from the array</returns>
        public static IEnumerable<List<T>> GetSubsets<T>(this T[] array)
        {
            int max = 1 << array.Length, l = array.Length - 1;
            for (int i = 1; i < max; i++)
            {
                if ((i & -i) == i) { continue; } //Exclude subsets of length 1

                List<T> subset = new List<T>(array.Length);
                subset.AddRange(array.Where((t, j) => (i & (1 << (l - j))) != 0));
                yield return subset;
            }
        }

        /// <summary>
        /// Finds the first index of the given value in the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="value">Value to find</param>
        /// <returns>The index of the value in the array, or -1 if it wasn't found</returns>
        public static int IndexOf<T>(this T[] array, T value) => Array.IndexOf(array, value);

        /// <summary>
        /// Finds the last index of the given value in the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="value">Value to find</param>
        /// <returns>The last index of the value in the array, or -1 if it wasn't found</returns>
        public static int LastIndexOf<T>(this T[] array, T value) => Array.LastIndexOf(array, value);

        /// <summary>
        /// Reverses the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to reverse</param>
        /// <returns>The reversed array</returns>
        public static T[] Reverse<T>(this T[] array)
        {
            Array.Reverse(array);
            return array;
        }

        /// <summary>
        /// Sorts the array with the default comparer of T
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to sort</param>
        public static void Sort<T>(this T[] array) => Array.Sort(array);

        /// <summary>
        /// Sorts an array with the given comparison method
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to sort</param>
        /// <param name="comparison">Comparison method to sort the array with</param>
        public static void Sort<T>(this T[] array, Comparison<T> comparison) => Array.Sort(array, comparison);

        /// <summary>
        /// Swap two elements in an array
        /// </summary>
        /// <typeparam name="T">Type of the array</typeparam>
        /// <param name="array">Aray to swap elements in</param>
        /// <param name="i">Index of the first element</param>
        /// <param name="j">Index of the second element</param>
        public static void Swap<T>(this T[] array, int i, int j)
        {
            T t = array[i];
            array[i] = array[j];
            array[j] = t;
        }

        public static void heapadd(this List<int> l, int i)
        {
            l.Add(i);
            for (int j = l.Count - 1; j >= 0;)
            {
                int t = (j - 1) / 2;
                if (l[j] > l[t])
                {
                    int temp = l[t];
                    l[t] = l[j];
                    l[j] = temp;
                }
                else
                    break;
                j = t;
            }
        }
        public static int heapdelete(this List<int> l)
        {
            int le = l.Count;
            int t = l[0];
            l[0] = l[le - 1];
            l.RemoveAt(le - 1);
            for (int i = 0; i < le - 1;)
            {
                int y = 2 * i + 1;
                if (y + 1 >= le - 1)
                {
                    if (y >= le - 1)
                        break;
                    if (l[i] < l[y])
                    {
                        int temp = l[y];
                        l[y] = l[i];
                        l[i] = temp;

                    }
                    break;
                }
                if (l[y] < l[y + 1])
                {
                    if (l[i] < l[y + 1])
                    {
                        int temp = l[y + 1];
                        l[y + 1] = l[i];
                        l[i] = temp;
                        i = y + 1;
                    }
                    else
                        break;
                }
                else
                {
                    if (l[i] < l[y])
                    {
                        int temp = l[y];
                        l[y] = l[i];
                        l[i] = temp;
                        i = y;
                    }
                    else
                        break;
                }
            }

            return t;
        }

        #endregion
    }
    #endregion
}


/*
 * Created by SharpDevelop.
 * User: tagirov2
 * Date: 20.04.2016
 * Time: 12:56
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Globalization;

namespace CF325A
{
	class Program
	{
		public static void Main(string[] args)
		{
//			Console.WriteLine("Hello World!");

			// TODO: Implement Functionality Here

			string [] s = Console.ReadLine().Trim().Split(' ');

			bool ok = true;
			for ( int j=0; j < s [0].Length; j++ )
				if (s [1][j] != s [0][j] )
				{
					ok = false;
					break;
				}

			if ( ok )
				Console.WriteLine (s [0]);
			else
				Console.WriteLine ("1");

//			Console.Write("Press any key to continue . . . ");
//			Console.ReadKey(true);
		}
	}
}
//
//Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
//Console.ReadLine().Split(new char[] {' ', '\t'}, StringSplitOptions.RemoveEmptyEntries);
//NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;
//string [] input = Console.In.ReadToEnd().Split(new char[] {' ', '\t', '\n', '\r'}, StringSplitOptions.RemoveEmptyEntries);


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication14
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] token = Console.ReadLine().Split();
            int n = int.Parse(token[0]);
            int k = int.Parse(token[1]);
            int inc = n;

            int kth = k;

            while(true){

            int npos = (int)Math.Pow(2,inc-1);
           // Console.WriteLine(npos +" "+kth);
            if(k%2!=0)
            {
               Console.WriteLine(1);
            }
            else if(npos==kth){
               Console.WriteLine(inc);
               break;
            }
            else{
                 kth = Math.Abs(kth - npos);
                 inc--;
            }

            }

        }
    }
}


using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string code = Console.ReadLine();
            List<char> result = new List<char>();
            for (int i = 0; i < n; i = i * (i + 1) / 2)
            {
                result.Add(code[i]);
            }
            Console.WriteLine(new string(result.ToArray()));
        }

    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace year
{
    class Program
    {
        static void Main(string[] args)
        {

int[] year=new int[4];
for(int i=0;i<year.length;i++)
{

    year[i]=int.parse(console.readline());
}

for(int i=0;i<year.length;i++)
{
    if(year[i]!=year[i+1]&&year[0]!=year[3]&&year[1]!=year[3]&&year[0]!=year[2])
     {
    for(int s=0;s<year.length;s++)
            {
                 year[3]+1;
                console.write(year[i]);
            }
     }
     else
     {
         for(int k=0;k<year.length;k++)
            {
                 year[3]+1;
            }
     }

}

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace year
{
    class Program
    {
        static void Main(string[] args)
        {

int  c_year;
string n_year;
            m = int.parse(Console.ReadLine());

            c_year++;
            while (true)
            {
              n_year =Convert.ToString(c_year);
                if  (n_year[1] !=  n_year[0] &&  n_year[0] !=  n_year[2] &&  n_year[3] !=  n_year[0] && n_year[1] !=  n_year[2] &&  n_year[1] !=  n_year[3] &&  n_year[2] !=  n_year[3])
                {
                   Console.WriteLine( n_year);
                }

               		     c_year++;
	}

}
}
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    private const int MOD = 1000000007;
    private const int MAXN = 5000;

    private long[,] t = new long[2, MAXN << 2];

    public void Update(int p, int v, int tl, int tr, int l, int r, long add)
    {
        if (l > r)
            return;
        if (l == tl && tr == r)
        {
            t[p,v] += add;
            if (t[p,v] >= MOD)
                t[p,v] -= MOD;
        }
        else
        {
            int tm = (tl + tr) / 2;
            Update(p, v * 2, tl, tm, l, Math.Min(r, tm), add);
            Update(p, v * 2 + 1, tm + 1, tr, Math.Max(l, tm + 1), r, add);
        }
    }

    public long Get(int p, int v, int tl, int tr, int pos)
    {
        if (tl == tr)
            return t[p, v];
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            return t[p, v] + Get(p, v * 2, tl, tm, pos);
        else
            return t[p, v] + Get(p, v * 2 + 1, tm + 1, tr, pos);
    }

    public object Solve()
    {
        int n = ReadInt();
        int a = ReadInt() - 1;
        int b = ReadInt() - 1;

        Update(0, 1, 0, n - 1, a, a, 1);
        int p = 0;

        for (int k = ReadInt(); k > 0; k--, p = 1 - p)
        {
            for (int i = 0; i < n << 2; i++)
                t[1 - p, i] = 0;
            for (int i = 0; i < n; i++)
            {
                long x = Get(p, 1, 0, n - 1, i) % MOD;
                if (i < b)
                {
                    int d = b - i - 1;
                    if (d > 0)
                    {
                        Update(1 - p, 1, 0, n - 1, Math.Max(0, i - d), i - 1, x);
                        Update(1 - p, 1, 0, n - 1, i + 1, i + d, x);
                    }
                }
                else
                {
                    int d = i - b - 1;
                    if (d > 0)
                    {
                        Update(1 - p, 1, 0, n - 1, i - d, i - 1, x);
                        Update(1 - p, 1, 0, n - 1, i + 1, Math.Min(n - 1, i + d), x);
                    }
                }
            }
        }

        long ans = 0;
        for (int i = 0; i < n; i++)
            ans = (ans + Get(p, 1, 0, n - 1, i)) % MOD;
        return ans;

        return null;
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
//        reader = new StreamReader("army.in");
//        writer = new StreamWriter("army.out");
#endif
        try
        {
            object result = new Solver().Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#else
            Console.WriteLine(ex);
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(ReadToken());
    }

    public static long ReadLong()
    {
        return long.Parse(ReadToken());
    }

    public static double ReadDouble()
    {
        return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }

    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][];
        for (int i = 0; i < numberOfRows; i++)
            matrix[i] = ReadIntArray();
        return matrix;
    }

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity];
        for (int i = 0; i < quantity; i++)
            lines[i] = reader.ReadLine().Trim();
        return lines;
    }

    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }

    #endregion
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace denemexxxx
{
    class Program
    {
        static void Main(string[] args)
        {
           try {
                string[] rule = new string[3];
                char[] x = new char[3];
                for (int i = 0; i < 3; i++)
                {
                    x = Console.ReadLine().ToCharArray();
                    if (x[1] == '<')
                    {
                        x[1] = '>';
                        Array.Reverse(x);
                        string s = new string(x);
                        rule[i] = s;

                    }
                    else
                    {
                        string s = new string(x);
                        rule[i] = s;
                    }
                }
                int[] sayi = new int[3];
                for (int i = 0; i < 3; i++)
                {
                    string s = "";
                    s = rule[i];
                    if (s[0] == 'A')
                        sayi[0]++;
                    else if (s[0] == 'B')
                        sayi[1]++;
                    else
                        sayi[2]++;

                }
                string a = "ABC";
                if (sayi[0] == 2 || sayi[1] == 2 || sayi[2] == 2)
                    Console.Write(a[sayi[0]] + "" + a[sayi[1]] + "" + a[sayi[2]]);
                else
                    Console.Write("Impossible");
                Console.ReadKey();
            }
           catch { }

        }
    }
}


using System;

class P {
  static void Main() {
    var n = long.Parse(Console.ReadLine());
    var max = (long)Math.Sqrt(n) + 1;
    var i = 1L; var j = n;
    while (i <= max && j > 0) {
      var d = i*i + i + j*j + j - 2*n;
      if (d == 0) { Console.WriteLine("YES"); return; }
      if (d < 0) {
        i++;
      } else {
        j--;
      }
    }
    Console.Write("NO");
  }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int num = 0;
            string res = "NO";
            num = Convert.ToInt32(Console.ReadLine());

            for (int i = 1; i < num - 1; i++) {
                for (int j = 1; j < num - 1; j++) {
                    if (num == ((i * (i + 1)) / 2) + ((j * (j + 1)) / 2))
                        res = "YES";
                }
            }

            Console.WriteLine(res);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

namespace bad_numbers
{
    class Program
    {
        static void Main(string[] args)
        {

            ArrayList list = new ArrayList();

            for (int i = 1; i < 45000; i++)
            {
                float temp = (float)(i * (i + 1)) / 2;
                list.Add(temp);

            }
            int nom = int.Parse(Console.ReadLine());

            bool flag = false;

            foreach (float temp in list)
            {
                if (temp < nom)
                {
                    foreach (float temp2 in list)
                    {
                        if (temp2 + temp == nom)
                        {
                            flag = true;
                            break;
                        }
                        else if (temp2 + temp > nom)
                            break;
                    }
                }
                else break;
            }

            if (flag)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");

            Console.ReadKey();
        }

    }

}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

namespace bad_numbers
{
    class Program
    {
        static void Main(string[] args)
        {

            ArrayList list = new ArrayList();

            for (int i = 1; i < 45000; i++)
            {
                float temp = (float)(i * (i + 1)) / 2;
                list.Add(temp);

            }
            int nom = int.Parse(Console.ReadLine());

            bool flag = false;

            foreach (float temp in list)
            {
                if (temp < nom)
                {
                    foreach (float temp2 in list)
                    {
                        if (temp2 + temp == nom)
                        {
                            flag = true;
                            break;
                        }
                        else if (temp2 + temp > nom)
                            break;
                    }
                }
                else break;
            }

            if (flag)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }
}


#define DEBUG
//#undef DEBUG
using System;
using System.Collections.Generic ;
using System.Linq;
using System.Text;
using System.IO;

namespace OlympSchool_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n,z,k,kn,zn;
            string s;
            string[] st;
            string toS;

#if DEBUG
            StreamReader sr = new StreamReader("b68.txt");
            s = sr.ReadLine();
#else
            s = Console.ReadLine();
#endif
            st = s.Split(' ');
            n = int.Parse(st[0].Trim());
            z = int.Parse(st[1].Trim());
            k = int.Parse(st[2].Trim());
#if DEBUG
            toS = sr.ReadLine().Trim();
            s = sr.ReadLine().Trim();
#else
            toS = Console.ReadLine().Trim();
            s = Console.ReadLine().Trim();
#endif
            kn = toS[3] == 'h' ? -1 : 1;
            int o = s.Length;
            string win="";

            for (int i = 0; i < o; i++)
            {
                if (z == k)
                {
                    win = "Controller 1";
                    break;
                }
                if (i+1==o)
                {
                    win = "Stowaway";
                    break;
                }

                if (k == n && kn>0) kn = -1;
                if (k == 1 && kn<0) kn = 1;

                if (s[i] == '0') //go
                {
                    if (z > k) zn = 1;
                    else zn = -1;

                    if (zn > 0 && z < n) z++;
                    if (zn < 0 && z > 1) z--;

                    k += kn;
                    if(k==z)
                    {
                        win = "Controller "+(i+1).ToString();
                        break;
                    }
                }
                else // stop
                {
                    k += kn;
                    if (kn > 0)
                    {
                        if (k > 1) z = 1;
                        else z = n;
                    }
                    if (kn < 0)
                    {
                        if (k < n) z = n;
                        else z = 1;
                    }
                }
            }

            Console.WriteLine(win);
#if DEBUG
            Console.ReadKey();
#endif
        }
    }
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JogandoDado", "JogandoDado\JogandoDado.csproj", "{8BD600EA-D66D-4028-ACEF-590E39A3970F}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{8BD600EA-D66D-4028-ACEF-590E39A3970F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{8BD600EA-D66D-4028-ACEF-590E39A3970F}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{8BD600EA-D66D-4028-ACEF-590E39A3970F}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{8BD600EA-D66D-4028-ACEF-590E39A3970F}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JogandoDados
{
    class Program
    {
        static void Main(string[] args)
        {
            int jogadaA;
            int jogadaB;

            jogadaA = int.Parse(Console.ReadLine());
            jogadaB = int.Parse(Console.ReadLine());

            ForcaBruta(jogadaA, jogadaB);
        }

        static void ForcaBruta(int palpiteA, int palpiteB)
        {
            int a = 0;
            int b = 0;
            int empate = 0;
            int[] dado = new int[6];
            for (int i = 0; i < dado.Length; i++)
            {
                dado[i] = i + 1;

                if (Modulo((palpiteA - dado[i])) < Modulo((palpiteB - dado[i])))
                {
                    a++;
                }
                else
                {
                    if (Modulo((palpiteA - dado[i])) == Modulo((palpiteB - dado[i])))
                        empate++;
                    else
                        b++;
                }
            }
            Console.WriteLine(" " + a + " " + empate + " " + b);
        }

        static int Modulo(int x) //retorna o valor positivo
        {
            if (x < 0)
                x = (x * -1);
            return (x);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

namespace ConsoleApplication6
{
    class Program
    {

        static void Main(string[] args)
        {
            int[] mas = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = mas[0], pos = mas[1], l = mas[2], r = mas[3];
            string res ="";
            if (l == 1 && r == n)
                res = "0";
            else if ((l==1 && r!=n ))
            {
                res = (Math.Abs(pos - l)+1).ToString();
            }
            else if ((l!=1 &&r==n))
            {
                res = (Math.Abs(pos - r) + 1).ToString();
            }
            else
            {
                int rt = Math.Abs(pos - r) < Math.Abs(pos - l) ? Math.Abs(pos - r) : Math.Abs(pos - l);
                res = ((r - l + rt) + 2).ToString();
            }
            Console.WriteLine(res);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeforcesTest
{
    class Program
    {
       // static void Main(string[] args)
       // {
       //     int input = Convert.ToInt32(Console.ReadLine());
       //     int temp = input;
       //     int numberOfDigits = (int)Math.Floor(Math.Log10(input) + 1);
       //     while (temp >= 10)
       //     {
       //         temp /= 10;
       //     }
       //     int nextLuckyYear = (int)((temp + 1) * Math.Pow(10, numberOfDigits - 1));
       //     int requiredYears = nextLuckyYear - input;
       //     Console.WriteLine(requiredYears);
       // }
    }
}


using System;

namespace _808A
{
    class Program
    {
        static void Main(string[] args)
        {
            int currentYear = int.Parse(Console.ReadLine());
            int foundYear = currentYear;
            bool isFoundHappy = false;
            while(!isFoundHappy)
            {
                foundYear++;
                if(IsHappyYear(foundYear))
                {
                    isFoundHappy = true;
                }
            }
            Console.WriteLine(foundYear - currentYear);
            Console.ReadLine();
        }

        private static bool IsHappyYear(int currentYear)
        {
            int countNotZero = 0;
            foreach (var digit in currentYear.ToString())
            {
                if (digit != '0')
                {
                    countNotZero++;
                }
            }
            if (countNotZero > 1)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
    }
}


 static void Main(string[] args)
        {
            int input = Convert.ToInt32(Console.ReadLine());
            int s = NextLuckyYear(input);
            Console.WriteLine(s.ToString());
        }

        static int NextLuckyYear(int year)
        {
            int luckyYear = 0;
            string sYear = year.ToString();
            if (sYear.Length == 1)
            {
                return 1;
            }
            string a = (Convert.ToInt32(sYear[0].ToString()) + 1).ToString();
            for (int i = 0; i < sYear.Length - 1; i++)
            {
                a += "0";
            }
            luckyYear = year - Convert.ToInt32(a);
            return luckyYear * -1;
        }


using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Text.RegularExpressions;
using System.Threading;

namespace CodeForces
{
    class Program
    {
        public static string Rw() => Console.ReadLine();
        public static int GetInt() => Int32.Parse(Console.ReadLine());
        public static int[] GetArr() => Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);

        public static void Main(string[] args)
        {
            int k = GetInt();

            int n = k;
            n++;
            if (n < 10)
            {
                Console.WriteLine(n -k);
                return;
            }
            while (true)
            {
                int a = n;
                int count = 0; //число ненулевых цифр
                while (a > 0)
                {
                    if (a%10 != 0)
                        count++;
                    a /= 10;
                    if (count > 1)
                        break;
                }
                if (count == 1)
                {
                    Console.WriteLine(n - k);
                    return;
                }
                n++;
            }

            // Console.ReadKey();
        }
    }

}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static int[] CountNegMatrix(int[,] tab)
        {
            int[] a = new int[tab.GetLength(0)];
            int k = 0;
            for (int i = 0; i < tab.GetLength(0); i++)
            {
                for (int j = tab.GetLength(1) - 1; j >= 0; j--)
                {
                    if (tab[i, j] % 2 != 0)
                    {
                        a[k] = -1;
                    }
                    else
                    {
                        int t = 0;
                        int r = j;
                        int count = 0;
                        while (t < tab.GetLength(0))
                        {
                            if (tab[r, t] < 0)
                            {
                                count++;
                            }
                            t++;
                        }
                        a[k] = count;

                    }
                    k++;
                }
            }
            return a;
        }
        static void Main(string[] args)
        {
            int[,] tab = { { -10, -2, -3 }, { 2, 3, 4 }, { 5, -6, 72 } };
            int[] a = CountNegMatrix(tab);
            foreach(int i in a)
            {
                Console.WriteLine(i);
            }
            Console.ReadKey();
        }
    }
}


using System;
class Program
{
    static void Main(string[] args)
    {
        int[] mas = new int[2];

        string[] tokens = Console.ReadLine().Split(' ');

        int i = 0;

        foreach (string x in tokens)
        {
            mas[i] = mas[int.Parse(x)];
            i++;
        }

        if (mas[0] == 0 && mas[1] == 0)
            Console.WriteLine("NO");

        else if (Math.Abs(mas[0] - mas[1]) < 2)
            Console.WriteLine("YES");

        else Console.WriteLine("NO");
    }
}


using System;
using System.Collections.Generic;
using System.Linq;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    void calc()
    {
        Scanner cin = new Scanner();
        long n = cin.nextLong();
        int MAX = 100000;
        int[,] dp = new int[MAX, 10];
        int[,] next = new int[MAX, 10];
        if (n == 0)
        {
            Console.WriteLine(0);
            return;
        }

        for (int j = 1; j < 10; j++)
        {
            dp[0, j] = 0;
            next[0, j] = 100000;
            for (int i = 0; i < MAX; i++)
            {
                int b = i;
                int dec = j;
                while (b != 0)
                {
                    int num = b % 10;
                    b /= 10;
                    if (num == 0) continue;
                    dec = Math.Max(dec, num);
                }
                if (i < dec)
                {
                    dp[i, j] = 1;
                    next[i, j] = 100000 + i - dec;
                }
                else
                {
                    dp[i, j] = dp[i - dec, j] + 1;
                    next[i, j] = next[i - dec, j];
                }
            }
        }

        int up = (int)(n / 100000);
        int down = (int)(n % 100000);
        long ret = 0;
        for (int t = up; t > 0; t--)
        {
            int dec = 0;
            int b = up;
            while (b != 0)
            {
                int num = b % 10;
                b /= 10;
                if (num == 0) continue;
                dec = Math.Max(dec, num);
            }
            ret += dp[down, dec];
            down = next[down, dec];
        }

        while (down > 0)
        {
            int b = down;
            int dec = 0;
            while (b != 0)
            {
                int num = b % 10;
                b /= 10;
                if (num == 0) continue;
                dec = Math.Max(dec, num);
            }
            down -= dec;
            ret++;
        }
        Console.WriteLine(ret);
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public long nextLong()
    {
        return long.Parse(next());
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace code_21_a
{
    class Program
    {
        static void Main(string[] args)
        {

            string s = Console.ReadLine();
            bool can=true;
            int k = s.IndexOf('@');
            if(k==-1 || k==0 || k==s.Length-1 || k>=17) can =false;
            if(can)
            {
                string first = s.Substring(0, k);
                for (int i = 0; i < first.Length; i++)
                {
                    if (first[i] == '_' || (first[i] >= 'A' && first[i] <= 'Z') ||
                   (first[i] >= 'a' && first[i] <= 'z') || (first[i] >= '0' && first[i] <= '9'))
                    {

                    }
                    else
                    {
                        can = false;
                        break;
                    }

                }
            }
            if (!can) {Console.WriteLine("NO"); return;}
            int kk = s.IndexOf('/');
            int to;
            if (kk == -1)
                to = s.Length;
            else
                to = kk;
            string second = s.Substring(k+1 , to-k-1);
            if (second.Length==0 || second.Length > 32 || kk==s.Length-1) can = false;
            if (can)
            {
                int kol = 0;
                for (int i = 0; i < second.Length; i++)
                {
                    if (second[i] == '_' || (second[i] >= 'A' && second[i] <= 'Z') ||
                   (second[i] >= 'a' && second[i] <= 'z') || (second[i] >= '0' && second[i] <= '9'))
                    {
                        kol++;
                    }
                    else
                        if (second[i] == '.')
                         if (kol > 0 && kol < 17) kol = 0;
                         else
                         {
                             can = false;
                             break;
                        }
                }
            }
            if (!can) {Console.WriteLine("NO"); return;}
            if (kk !=-1)
            {
                string third = s.Substring(to+1,s.Length-to-1);
                if (third.Length > 16) {can = false; break;}
                for (int i = 0; i < third.Length; i++)
                {
                    if (third[i] == '_' || (third[i] >= 'A' && third[i] <= 'Z') ||
                   (third[i] >= 'a' && third[i] <= 'z') || (third[i] >= '0' && third[i] <= '9'))
                    {

                    }
                    else
                    {
                        can = false;
                        break;
                    }

                }
            }
            if (!can) {Console.WriteLine("NO"); return;}

            Console.WriteLine("YES");

         }
    }
}


using System;
class Program {
  static void Main()
{
  var s1 = Console.ReadLine();
  var s2 = Console.ReadLine();
  var i = 0;
  foreach (var c in s2) if (c == s1[i]) i++;
  Console.WriteLine(i+1);
}


using System;
using System.IO;

class Algo
{
    int[] f = new int[22];
    public void Run()
    {
        f[0] = 1;
        for (int i = 1; i < 22; i++) f[i] = f[i - 1] * i;
        string s1 = cin.ReadLine();
        string s2 = cin.ReadLine();
        int plus1 = 0, plus2 = 0, q = 0;
        for (int i = 0; i < s1.Length; i++) plus1 += (s1[i] == '+' ? 1 : 0);
        for (int i = 0; i < s2.Length; i++)
        {
            plus2 += (s2[i] == '+' ? 1 : 0);
            q += (s2[i] == '?' ? 1 : 0);
        }
        if (plus1 > plus2 + q)
        {
            cout.WriteLine("0.0");
            return;
        }
        int n = C(q, plus1 - plus2);
        int m = 1 << q;
        double ans = 1.0 * n / m;
        string res = ans.ToString();
        for (int i = 0; i < res.Length; i++)
        {
            if (res[i] == ',') cout.Write(".");
            else cout.Write(res[i]);
        }
        cout.WriteLine();
    }

    int C(int n, int m)
    {
        int ans = f[n] / f[m] / f[n - m];
        return ans;
    }

    public StreamReader cin = null;
    public StreamWriter cout = null;
}

class Program
{
    static void Main()
    {
        Algo task = new Algo();
#if DEBUG
        task.cin = new StreamReader("input.txt");
        task.cout = new StreamWriter("output.txt");
#else
        task.cin = new StreamReader(Console.OpenStandardInput());
        task.cout = new StreamWriter(Console.OpenStandardOutput());
#endif
        task.cout.AutoFlush = true;
        task.Run();
    }
}