Question: This is the full question:
**Write a Python program to get a string from a given string where all occurrences of its first char have been changed to '$', except the first char itself.
Sample String : 'restart'
Expected Result : 'resta$t'**

The code I gave was as follows:

```
e="Test string"
f=""
for k in range(0,len(e)):  
    if(str[k]==e[0]):
        f+="$"
    else:
        f+=e[k]
print("New string: ",f)

```

The error I got back was in this line:
if(str[k]==e[0]):
The error shown was TypeError: 'type' object is not subscriptable
***I made an observation that if I replaced the variable e with str, I get the result without issues. Does this mean I can only run this code using str as a variable, or is there an alternate solution?***

Answer: 
Finally solved this. I had tried with Charset unicode on the DLL call previously, but I had missed setting it on the structs:

```
[DllImport(DLL, CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]
private static extern void CalculateData(MyDLLQuery indata, out MyDLLResult outdata, CallbackDelegate f);

```

```
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MyDLLQuery
...

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MyDLLResult
...

```
```
    StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
    public struct Result
    {
        //SizeCount bezieht sich anscheinden auf Char (hier 2 Byte) und
        // nicht auf die Bytegröße des Felds
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)] public string BIC; //Delphi: array[0..10] of char
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 35)] public string IBAN; //Delphi: array[0..33] of char
        [MarshalAs(UnmanagedType.I4)] public BACIbanKonverterStatus Status;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 201)] public string StatusMessage;
        //Delphi: array[0..199] of char

        [MarshalAs(UnmanagedType.Bool)] //Delphi: Longbool
        public bool Success;
    }

```

Has been implemented in Delphi as follows :

```
 TRecIban=packed record
public
  Bic          : array[0..10] of char;
  Filler_1     : Char;
  Iban         : array[0..33] of char;
  Filler_2     : Char;
  Status       : integer;
  StatusMessage: array[0..199] of char;
  Filler_3     : Char;
  Success      : Longbool;
end

```

The end of the string in C # is mapped to the *Filler\_X* in Delphi. Today I would marshal over *[MarshalAs (UnmanagedType.LPWStr)]* in C #. In Delphi I would use a *PChar*. Then the filler is unnecessary.