Răspuns:
#include <iostream>
#include<cstring>
using namespace std;
char s[21];
int i;
int main()
{
cin>>s;
for(i=0;i<strlen(s);i++)
if(s[i]=='A'&& s[i+1]=='I')
{strcpy(s+i,s+i+1);
i--;
}
else
if(s[i]=='I'&& s[i+1]=='A')
{strcpy(s+i+1,s+i+2);
i--;
}
cout<<s;
}
Explicație: