/*********************************************************************************/
/* Assignment 1: String Delete Then Add ******************************************/
/* Name: Jaemyeong Eo *****************************************************/
/*********************************************************************************/
/*********************************************************************************/
/* Usual suspects to include *****************************************************/
/*********************************************************************************/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
/*********************************************************************************/
/* Global string which to operate on *********************************************/
/*********************************************************************************/
char string[1024];
/*********************************************************************************/
/* delete_then_add function ******************************************************/
/*********************************************************************************/
void delete_then_add( char *string, int len )
{
int i=0;
int count_as=0;
int count_bs=0;
count_as = count_bs = i; // get rid of warning
// YOUR WRITE THIS FUNCTION -- it's short on code, but a little tricky to get right
// first phase - remove the B's but don't pass over newling "\n"
// second phase - add the a's starting at the back and move to the front of the string
}
/*********************************************************************************/
/* main function *****************************************************************/
/*********************************************************************************/
int main( )
{
printf("Please enter a string with a's and b's in it: \n");
if( NULL == fgets(string, 1024, stdin))
{
printf("Error in reading string from stdin");
exit(-1);
}
delete_then_add( string, strlen(string) );
printf("The new string is: %s\n",
string );
return(0);
}