#include <iostream>
#include <string.h>

using namespace std;

int main ()
{
    char s[100];

    cout << "The string is: " << endl;
    cin.get(s, 100);

    int len = strlen(s);
    for (int i = 0; i < len; i++) {
        if (s[i] == 'a') {
            if ((len+3) > sizeof(s)) break; // no more space!
            memmove(s+(i+3), s+(i+1), sizeof(s)-(i+1));
            s[i+1] = 'a'; s[i+2] = 'a';
            i += 2;
            len += 2;
        }
    }

    cout << "The modified string  is: " << endl;
    cout << s;
}