/* Assignment: Write a function called deleteRepeats that takes an array of characters as a formal parameter and will delete repeated occurrences of letters from the array. Since a partially filled array requires two arguments, the function will actually require two formal parameters: an array parameter and a formal parameter of type int that gives the number of characters stored in the array (the elements must be stored contiguously in the lowest index positions within the array). When a letter is deleted, the following letters must be moved forward within the array to fill the gap. These actions will create new positions within the unused portion of the array, so that fewer array positions are filled. This second parameter must be a call-by-reference parameter which must be altered to reflect the possible changing number of array positions used by the elements of the array, after the repeated elements are deleted. For example, consider the following code: char a[10]; a[0] = 'a'; a[1] = 'b'; a[2] = 'a'; a[3] = 'c'; int size = 4; deleteRepeats(a, count); After this code is executed, the value of a[0] is 'a', the value of a[1] is 'b', the value of a[2] is 'c', and the value of size is 3. */#include <iostream>using namespace std;void deleteRepeating(char a[], int& size);// Preconditions: a is a character array with size amount of elements used// Postconditions: a is a character array with repeating elements deleted.// Size is updated to reflect the new array.int main(){ char a[10]; int size = 9; a[0] = 'a'; a[1] = 'b'; a[2] = 'a'; a[3] = 'c'; a[4] = 'a'; a[5] = 'e'; a[6] = 'e'; a[7] = 'c'; a[8] = 'f'; deleteRepeating(a, size); cout << "New size is: " << size << endl; for (int i = 0; i < size; i++) cout << a[i] << endl; system("pause"); return 0;}void deleteRepeating(char a[], int& size){ for (int first = 0; first < size - 1; first++) { for (int second = first + 1; second < size; second++) { if (a[first] == a[second]) { for (int mover = second; mover < size - 1; mover++) { a[mover] = a[mover+1]; } a[size - 1] = NULL; size--; } } }}