Toggle navigation
Courses
Questions
Tags
Users
AD 字串 練習題 搜尋
0
like
0
dislike
1.1k
views
請設計一個程式,使用者會輸入兩個字串,請搜尋第一個字串當中第二個字串出現幾次。
輸入說明:使用者會輸入兩個字串,兩個字串接用雙引號("")包起來,兩個雙引號間會用一個空白隔開。
輸出說明:請輸出第二個字串在第一個字串中出現幾次。
輸入範例:
"The racing car was clocked at 160 miles p.h. " "a"
輸出範例:
4
asked
Dec 8, 2016
in
2016-1 程式設計(一)AD
by
Shun-Po
(
18k
points)
|
1.1k
views
answer
comment
Please
log in
or
register
to add a comment.
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or
register
.
Add answer
Cancel
21
Answers
0
like
0
dislike
Hidden content!#include <stdio.h>
#include * * ** * * *
int main(void){
* * * ** * ** * * ** * *** * * i,j,k,len1,len2;
* ** * * * ** * ** * * ** c,c1[50],c2[50];
*** * *** ** ** * * * * * c1ptr;
* * * * * *** * *** * *
* * * ** * * * * * * * * * * * *** * "
**** *** * * ** * * ** * * * * ** * * = getchar() && c != '"');len1++)
* * *** * * * * ** * * *** * * * ** * * * * * *** * * = c;
** * * **** * ** * * * = '\0';
* ** ** ** ** * ***
* * * *** * * * * * ** * * * ' '