#include
#include
using namespace std;
int main()
{
string str1;
getline(cin,str1);
int len=str1.length();
int temp[len];
int j=0,cnt=1;
for(int i=0;i<len;i++)
{
temp[j]=str1[i];
if(temp[j] !=str1[i])
{
j++;
temp[j]=str1[i];
cnt++;
}
}
for(int k=0;k<cnt;k++)
{
cout<<temp[k];
}
}
Ascii value is the output;expected output one time occured values
Hey, you can use typecasting like this cout<<(char)temp[k];
1 Like