#include <iostream.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>
//Function 1
void upgrade(int &acr)
{ acr=9; cout<<"\n\n>Successfully updated the file."; getch(); }
//Function 2
void search(char ch[160],char acronym[9][36],int acr)
{ int count,c=strlen(ch);
for(int i=0;i<acr;i++)
{
for(int j=0;acronym[i][j]!='=';j++);
for(int k=0;k<=c;k++)
{ for(int l=0,count=0;l<j;l++)
if(toupper(ch[k+l])==acronym[i][l]) count++;
if(count==j) {cout<<'\n'<<acronym[i]; break;}
}
}
}
//Function 3
void display (char ch[160], char acronym[9][36],int acr)
{ int i,j,k,l,count,p;
for(i=0;i<=strlen(ch);i++)
{ for(j=0;j<acr;j++)
{ for(l=0;acronym[j][l]!='=';l++);
for(k=0,count=0,p=0;k<l;k++)
if(toupper(ch[i+k])==acronym[j][k]) count++;
if(count==l) {i+=l-1; for(l+=1;acronym[j][l]!='\0';l++) cout<<acronym[j][l]; p=1; break;}
}
if(p==0)
cout<<ch[i];
}
}
// Function main()
void main()
{
clrscr();
int acr=2, c;
char ch[160], acronym[9][36]={"LOL=laughing out loud",
"IRL=in real life",
"AFK=away from keyboard",
"BFF=best friends forever",
"FWT=for the victory",
"IIRC=if I recall correctly",
"IMHO=in my humble opinion",
"NVM=never mind",
"TTYL=talk to you later"};
cout<<">Press \"u\" if you want to upgrade the program's acromyms' list. ";
c=getch();
if(c==85||c==117) upgrade(acr);
clrscr();
cout<<">Enter your tweet(max. 160 characters): "; cin.getline(ch,160);
search(ch,acronym,acr);
cout<<"\n\n>Converting user's tweet......\n\n";
display(ch,acronym,acr);
getch();
}
I2luY2x1ZGUgPGlvc3RyZWFtLmg+CiNpbmNsdWRlIDxjb25pby5oPgojaW5jbHVkZSA8Y3R5cGUuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKLy9GdW5jdGlvbiAxCnZvaWQgdXBncmFkZShpbnQgJmFjcikKeyBhY3I9OTsgY291dDw8IlxuXG4+U3VjY2Vzc2Z1bGx5IHVwZGF0ZWQ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