You’ve quoted your code, rather than using the </> code formatting option in the editor which isn’t great for us to be able to copy and run your code to help troubleshoot.
The actual root cause of your error: Preformatted textProgram.cs(19,11): error CS1001: Identifier expected [/home/ccuser/workspace/csharp-working-with-text-get-parts-of-strings/e7-workspace.csproj]
is your variable declaration here: int 2ndcharPosition = name.IndexOf("Hesam Abbasi");
It’s not valid syntax in C# to start a variable name with a number.
As for why it allowed you to progress? I can only assume that, despite the error in your code, you’ve met whatever the requirements were for the SCT. (I guess it must just be looking, maybe using regex, for you to have included the method calls the instructions ask for.)