```
using System;

namespace stringdouble
{
    public class populate
    {
        public string string1;
        public string string2;

        public populate (string string1 ,string string2)
        {
            for (int i=1; i < string1.Length; i++)
            {
                if (string1[i] == string1[i-1])
                {
                    string2[i] = string1[i];//error on this line
                    Console.WriteLine ("Character Copied");
                    Console.ReadKey();
                    Console.Clear();
                }
            }

            Console.WriteLine (string2);
        }
    }

```

This is the code but for some reason its giving me the error I entered above. I am trying to remove the duplicates in a string and copy them into a new one.

I call this by `new populate(FirstString, SecondString);`.