include stdafx include conio include iostream include stdlib using nam

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "stdafx.h"
#include <conio.h>
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
string s= "SATORRRRRAREPOTENET";
string s1="";
int arr[32];
int c=0;
int i=0;
for( i;i<31,s[i]!='\0';i++)
{
arr[i]=s[i];
}
arr[i+1]='\0';
for(int i=0;arr[i]!='\0';i++)
{
if(arr[i]==arr[i+1])
{c++;}
else{
char ch=c+48;
if(c>3){
s1+="@";
s1+=ch;
s1+=arr[i];
c=0;}
else{while(c>=0){s1+=arr[i-c];c--;}}
c=0;
}
}
for(int i=0;s1[i]!='\0';i++)
{
cout<<s1[i];
}
system("PAUSE");
return 0;
}