0 like 0 dislike
1.3k views

Write a program that reads a string of up to 100 characters and displays it after remove all 'a' characters that exist at the beginning and at the end of the string. For example, if the user enters "aabbadaa", the program should display "bbad".

Sample Input 1:

aaTriHarda

Sample Output 1:

TriHard


Sample Input 2:

ResidentSleeper

Sample Output 2:

ResidentSleeper

 

[Exercise] Coding (C) - asked in C
ID: 22314 - Available when: Unlimited - Due to: Unlimited

edited by | 1.3k views

97 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>

int main(){
* * *** ** **** ** * * s[80], c;
*** ** ** * * * * * ** j, k;
* ****** * * * * *** **
* * * ** * * * *** ** * ** s[j]!='\0'; j++)
** *** * * ******* ***** ** * ** * **
* * *** ** ** * ***** ** *** * * ** * * * * * * *** * * ** * * * *
***** * * **** * *** * ** * * '\0';
** * * ** * *** * ** * * * ** *********
* **** * **** ***** *** * * 0;

}
answered by (24 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>

#include <string.h>



int main(){
* * *** ** ** * ** * a[100];
*** *** *** ** ** *** i,j,c;
* **** ** *** * ** * *** ** * *
* * ** * * * * * * = strcmp(a,"End");
**** * * * * * *** **
** * * * * ** * * * * ********* * **** **** *** *
* ** * * *** * * ** * **** * * * * * ****** * **** **** * * * * **
***** ** * **** *** * * * * ** **** * * ** ** ** * * ** * * ***** ** * *** ** * **** ** ***
* ** * *** * * * * * *** * * ** ******* * *** *** **** ******   
*** * **** ** * * *** * * * ** ** *** *
* *** ** ** * ** *** *** **** * * * * * *
* ****** * ** * ** * *** * * * *** **** *** * * * ** * *
* * * * ** ** * *** ******* *** * **** ** *** **** * ** ** **
* *** ** * * * **** ** * ** *** * * * * * * * * = strcmp(a,"End");    

    }
** ** *** * * ** * * 0;

}
answered by (24 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>

#include <string.h>



int main(){
***** ** ** * * *** ** *** a[100];
** **** * **** * *** * *** i,j,c;
* * * * ***** * * *** *** * ** * **
* **** ******* ** = strcmp(a,"End");
** * * *** * *** * * *** * ** *
*** ********* * ******* * **** ** * * * ** * *
* * * * * * * ****** ** ** * * * * * * ** * ** * *** ** * * *** ** ****
** ** * *** * **** * ** *** * * *** ** *** * * *** * ***** * *** **** * ** ** * **** *** * **** *
* * * ** *** * ** ** ***** *** * ***** ****** ** * ***   
* ** **** ** *** **** *** ** * * ********
***** * * **** * ****** * *** * * * ***
* * * * *** * ** * *** * * * * ****** * ** *** * * ** ** * **
*** * **** ** **** ** * ** ******* ** * * * * **** ** * * ******
******* ** ** ** * * ** ** * ** ** ** * ****** = strcmp(a,"End");    

    }
* ** * * * * ** * * ** *** ** 0;

}
answered by (24 points)
0 like 0 dislike
Hidden content!
*** * * ** *** * *
** * ** ** * **** *****

*

** * * = * * *
* *** * *
* * *********** ** ** * *
* ** * * * * *** * *
** * * * * *

**

* **

}

* * = * * ** ** - ** i * * ** {

* * * * *

* ****
**
**

* * *** *** ** * ** * ** *
* ** * ****** ** * ** *
*

}
answered by (44 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<string.h>

int main(void){
*** ** ** *** ****** i,count=0;
***** * * * * * * ** ** * str[100];


** ** ** * * **** * **** * *** * * * &str);
* *** * ***** **** *p = str;
* **** * * ** * ** * ** * * ** *** i++){
** ** ** ** * * * * ** ** * *** *** * ** ****** * * **
********* * * *** *** * ** ** * * * * ** * ***** ** * * * *** *** **
** ** ** * * * *** **** ** *** * ** * ** *** * ** ***
** *** * * * * ****** * ****** * * ** * * *** **** * * ** * * * * * * * * *

    }
*** **** * *** * * ** i>=0; i--){
** **** * *** ** * * *** *** *** * ** **** * * ** *
** *** **** * * ** * **** ** * * * * *** *** * ** * ** * *
* * ** * ** * * * *** * * ***** * * *****
**** ** * * **** * * ** ***** * * *** * *** * * ****** * *** *



    }
* *** * * * ******* * ** ** ** * * * i++){
** *** * ** * * **** **** ******* * *** * * ** ** * *** *** p[i]);
* **** * * * *****


** * * * *** ** 0;

}

#include <stdio.h>

#include <string.h>



int main()

{
* ** **** * **** ** **** len,i,n=0;
* * *** * **** ** * word[100], *w = word;
* ** * * * * * ** * * ** * * ** &word);


* ******* * * * * = strlen(word);


***** * * * * ** ** * ** * = 0; i < len; i++)

    {
** **** * * * **** * ***** * ** **** **** * * * == 'a')
* * **** ***** **** *** ***** * ** * * * *
*** * * * * *** * * *** ** * ** ** ** ***** ** ** * **** * * *
* **** * * * ** * *** * * ** *** else {
* **** * *** ***** *** * * *** * * ** * * * * *** ** ** *
** * **** ** ** * * ** * * ** **

    }


** ****** * ** **** ** = strlen(w);


* ** ** * * ** ***** ** = len-1; i >= 0; i--)

    {
* *** ** *** **** ** *** *** **** * * * * ** == 'a')
* ******* ** * *** ***** * ** ***** * * ** ** *
** * * ** * ** **** * * * * * ** * * ******** * * ****** * * ** ***
* * ** * *** ** ***** * ** * * * * * * else {
*** *** * * * *** * **** * * ** * *** * ** *** ** ** *** * *
**** * ** * *** * ** ***** *** ** ** **** **

    }


* * ** * ** *** * * * ** ** ***** **




** *** * * *** ** 0;

}
answered by (44 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



#include ** * *







int main()



{


** *** * * * ** ** ** i, count1 = 0, count2 = 0;


* * ** ** *** * input[100];


*** * ******** * ** *** * ** * &input);


* * * * * * *** * (i = 0; i < strlen(input); i++)


* * * *** * *** ** * ** *


**** * ** ** * *** *** *** * ** ** * ** *** (input[i] == 'a')


* * *** ******** ** * * ****** ** * * ** *** ** *** * ** *** * ****** ** ** **


* *** ** * * * ***** * *** **** * ** * ** **


**** * ***** *** * ** ******* ***** * * **** **** * **** * * * * ** ** *


*** ** ** *** * ** * ****


** * * ** *** *** (i = strlen(input) - 1; i >= 0; i--)


* * * * * ***** ******


****** * ** * *** ** ** **** *** * ** * *** ** **** == 'a')


* * * * * * ** **** * **** ******* * * * * * **** *** **** ** ** ****** *


* * * * ** **** *** *** ***** * ***


** ****** ** *** ***** * ** * *** ** * ** ** * *** * ** *


** * * *** ** *** *****


* ** **** ** ** ** * * (i = count1; i < strlen(input) - count2; i++)


* *** ****** * *** * * ***** ******** * **** ** ** * ** ** input[i]);


* *** * * * ***** * * * ** 0;



}
answered by (6 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



#include * * ** ** *







int main()



{


***** ** ******* * **** ** i, count1 = 0, count2 = 0;


* ***** * * ***** input[100];


* * * *** * **** * ** **** ** ** &input);


* *** * * * * ** * (i = 0; i < strlen(input); i++)


*** * ** ** ** ** **


*** ** * ** * ** * * *** * * * ** ** *** ** (input[i] == 'a')


** * * * * ** ** * *** ** ** * ** * ** ** * * * *** * ** * *


****** ** * ** ** * **** * ** *** ** * * * * * * *


* ** **** * * ** *** ** ** ** * *** ** *** ** **** *** * * * *


*** ** * ** * * * **


* ** ** ** * ** (i = strlen(input) - 1; i >= 0; i--)


***** ****** ** * ** ***


****** ** * * * ** * * * ** *** * ***** ** * == 'a')


********* **** ** * ** ** * ***** *** * ** * * ** ******


*** ** ** *** * * * * * ** ** * ***


** * * * *** * * * ** * ** ** * ** ** ** ** * ******* **


* **** **** ******


**** ** ** ** ** * ** * (i = count1; i < strlen(input) - count2; i++)


* * ** *** ** *** * * * * * ** ** ** * ** **** **** input[i]);


* * * ***** ** ** *** ** 0;



}
answered by (-298 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



#include * ***** *







int main()



{


* ** *** * *** * *** * i, count1 = 0, count2 = 0;


* ***** *** *** **** * input[100];


* * ** * * * ** * * * ** &input);


* ** * ** **** ***** (i = 0; i < strlen(input); i++)


* **** ** * ** ** ** * *


***** *** **** ** **** ** * **** **** ** * * ***** (input[i] == 'a')


*** ******** * ** * *** *** *** * **** * * * * *** * * *** * **** *


* ** ** * ***** *** * ** * * * * ** *


* * **** ** * * *** ** *** *** ** ** **** * * * **


******* ** * *** *** * **


**** * * * ** * ***** ** * (i = strlen(input) - 1; i >= 0; i--)


** ** * ** * *


* **** *** ** * ** ** * * **** * * * == 'a')


****** * * * *** * * * ******** *** ** ***** * *** ** * * ** *


* * * **** ** *** * * *** ** * * ** ** * * *


* *** * ** ** * * * ** * * * * ** ** ** ** * * ** * **** * ** *


*** *** * *** ** *** **


* * * * ** ** **** ** * (i = count1; i < strlen(input) - count2; i++)


** *** * * * * *** * **** ** ** * ** **** *** input[i]);


** * ** * * * * * ** 0;



}
answered by (126 points)
0 like 0 dislike
Hidden content!
#include * * *** * * *



void * ** * * a[], int n, int *largest, int * ** * ****



int main(void)

{
*** * * * * * * * * n, i, largest, second_largest;
* ** *** * ** ** ** * * ****** ** *** * &n); //Numbers will be entered
* ** * * ** * ** ** * * a[n];
** * *** * *** * * ** * n integers separated by spaces
** ** * * * (i = 0; i < n; i++)
* **** **** * * * *** * ** ** * ** %d", * ** ***


** **** ** * ** ** * * * n, ** * ** ***** **** *** **


** *** ** ** **** **** * (n == 0)
** *** * ** *** * ** ** * * * ** ** ***** ** numbers were * * ** ***
*** *** **** * * * if (n == 1)
* *** * * *** * ** * * *********** * * * * * *** one number was entered. Largest: %d", largest);
** **** ** * **
* *** *** *** * * ** ** *** ** * * **** ** * *** ** ** ***** %d, Second Largest: %d", largest, ***** * **


* * * * ***** * * ** *** 0;

}



void * *** * a[], int n, int *largest, int ** * **

{
**** * ** * * * * ** i, j = 0;
** ** ****** ** *** * ** * = a[0];
* *** ***** * * * *** = 0; i < n; i++)
** ** * ** ***
**** * **** *** ** **** * *** ** * * * * ** < a[i])
* * * *** * * ** * * * *** ** *** * *
* ** * ** * ** **** * * * ****** * * ***** *** * * * * ** *** = a[i];
* * *** * **** **** ** * * ** ** ** * * * *** ** * **** * * * *** = i;
* * * *** *** * ***** * **** * * ** * **** *
* * * *** * * * * *


* *** * ** ** ***** *** = a[0];
* ** * * ** ** ** = 0; i < n; i++)
* **** * * * ** *
*** ** ** * ** **** * ***** * ***** ** * **** > *second_largest * i != j)
* ** * ******** ** * * *** * ** *******
* ** ** **** * * *** ** * * * *** ******* ***** * * ** ** * ***** **** ** = a[i];
* ** * * * * * * **** * * *** * **
* * ** * * ** ** *** *

}
answered by (126 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <string.h>



int main()

{
***** * ***** * **** * * i, count1 = 0, count2 = 0;
* ** *** * ** * ** input[100];
**** ** * * * ** * * ** ** * * * &input);
** ** ** * * * **** (i = 0; i < strlen(input); i++)
***** ** * ** ** *
** * ** * * ** * *** *** **** *** *** (input[i] == 'a')
* * ***** * *** * **** * ** * * * ****** ** * *** ** * * * * *
** *** ** **** * * * ** ***** * * ** ***
*** *** *** ** * ***** * *** * * * * * * ** * * * *** *** *** *
* * * ** ** *
* **** *** * ** * * (i = strlen(input) - 1; i >= 0; i--)
********** * * **** * *
** * **** ** * ** * * * * ** ******* * ** * * * == 'a')
******** * ** * ** ******* ******* * ** * * ** **** ** * ***
* *** ** ** ** * *** * ** ** * * * **** ****** **
* *** * * *** * *** * ** ** ** *** * * * * ***** * * ** **
* * *** * * ** ***
* *** * * * * *** * ** (i = count1; i < strlen(input) - count2; i++)
* * *** * * ** * *** *** ** * * * * ** * * * * * ***** * input[i]);
* ********* * ** ** ** 0;

}
answered by (237 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.7.22
©2016-2024

Related questions

0 like 0 dislike
23 answers
[Exercise] Essay (Open question) - asked Mar 23, 2017 in C
ID: 23262 - Available when: Unlimited - Due to: Unlimited
| 690 views
0 like 0 dislike
87 answers
[Exercise] Coding (C) - asked Mar 2, 2017 in C
ID: 22313 - Available when: Unlimited - Due to: Unlimited
| 1.4k views
1 like 0 dislike
58 answers
[Exercise] Coding (C) - asked Mar 23, 2017 in C
ID: 23261 - Available when: Unlimited - Due to: Unlimited
| 1.1k views
0 like 0 dislike
50 answers
[Exercise] Coding (C) - asked Mar 16, 2017 in C
ID: 22973 - Available when: Unlimited - Due to: Unlimited
| 972 views
12,783 questions
183,443 answers
172,219 comments
4,824 users