Codeforces String Task Need Help

codeforces

#1

Can anyone tell me why my test case gives SIGSEV when input is
femOZeCArKCpUiHYnbBPTIOFmsHmcpObtPYcLCdjFrUMIyqYzAokKUiiKZRouZiNMoiOuGVoQzaaCAOkquRjmmKKElLNqCnhGdQM
The problem is String Task
Here is my implementation:

#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goe
	string s1;
	string s2 = "";
	cin>>s1;
	int c = 0;
	int len = s1.length();
	for(int i=0;i<len;i++)
	{
	    s2* = tolower(s1*);
	    if(s2* == 'a' || s2* == 'e' || s2* == 'i' || s2* == 'o' || s2* == 'u' || s2* == 'y')
	        continue;
	    else
	        cout<<'.'<<s2*;
	}
	return 0;
}

#2

The reason why your code is giving TLE is because you have a string named s2 that is empty and you want to assign s2* = (some character) where i belongs to [0,1,…,len-1]. This basically means you want to write at some memory location that your program doesn’t have access to write. So what you need to do is instead of string s2 you can make a char variable and it will be fine or alternatively you can resize s2 to len by s2.resize(len); then also it will be fine.