I was practising in a problem here in codeforces,and I wanted to train my C# skills a bit. So I wrote an answer about the problem,and when I tested it throwed "time limit exceed". I was curious about a faster way,so I checked 2-3 another sources,and I found a very similar one in C++. So I wrote the same program in C++,and my answer was accepted.
Why happened that?
Your submission list shows no attempts in C#.
click "show unofficial"
Your C# code TLs because these operations in .Net have O(len(str)) complexity:
Read about strings in .Net and about StringBuilder class.
Ohh that sounds interesting,but what you would suggest to fix that? You suggest to use that "StringBuilder" ?
Yes, StringBuilder will allow you to use that approach you used with the performance you thought it would have.