Toggle navigation
Courses
Questions
Tags
Users
AC 字串 練習題 搜尋
0
like
0
dislike
2.1k
views
請設計一個程式,使用者會輸入兩個字串,請搜尋第一個字串當中第二個字串出現幾次。
輸入說明:使用者會輸入兩個字串,兩個字串接用雙引號("")包起來,兩個雙引號間會用一個空白隔開。
輸出說明:請輸出第二個字串在第一個字串中出現幾次。
輸入範例:
"The racing car was clocked at 160 miles p.h. " "a"
輸出範例:
4
asked
Dec 7, 2016
in
2016-1 程式設計(一)AC
by
Shun-Po
(
18k
points)
|
2.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
24
Answers
0
like
0
dislike
Hidden content!
* * *** * * *
****** * *
* * * ** ** *
int main(){
* ** ** * *** ** ** ** a[80]={0}, b[80]={0}, c[80]={0}, d[80]={0};
**** ** * *t;
* * **** * ** * * i, j = 0;
*** * * * * ** **** ****** **** * * ** * a);
* ** * * *** * ** * **** * * * * **** **** ** ** b);
* * * ** * * * * * sizeof(b), stdin);
* * ** ** *** * ** ** * * * * * ** ** a, b);
* * ******* *** ** ** = strtok(a, b);
**** * * * ** * != NULL){
***** ** * ** * * *** * ** ***** * * *
* * *** *** * * *** * **** ***** *** * ** ** *** ** t);
* * * ** ******* ** ******* = strtok(NULL, b);
*** ***** * * *
** * ** * **** * ** **** * * j - 1);
return 0;
}
answered
Jan 3, 2017
by
410342026
(
-105
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
** *** * * * ** * ****
*** * **** ** * *
* * * * *
int main(){
* * * ** * ** * * * a[80]={0}, b[80]={0}, c[80]={0}, d[80]={0};
* *** * ** ***** * *t;
* **** * ** ** *** i, j = 0;
* * *** ** ** * * ** * *** ** * ****** ** a);
** **** * * * ***** * * * ** ** * ***** * * * * ** * b);
* ** **** ** * * sizeof(b), stdin);
**** ** * ** ***** * * * ***** ** a, b);
* **** ** *** = strtok(a, b);
* *** * * ** * *** * * * != NULL){
**** * *** * * **** ** *** * * *
* * * *** * ** ** * * *** ** * ** * * ***** * * t);
* * * * * ** * * ** = strtok(NULL, b);
** **** *** *** ** ***
** *** ** *** * *** * * j - 1);
return 0;
}
answered
Jan 3, 2017
by
410342026
(
-105
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include ** * *** ***
#include * ****** **
#include ** ** ** * * * **
*** ** * racing car was clocked at 160 miles p.h. * * * *** * * ** * **
int * ********
* * *** *
* * * * * * int ******* * ** * *** * *
*** *** ***
* ** char *****
** * * * ****
** *** ** * ** * * * * ***
** * **
* ** *** while (c[i] != 34) ******* * * * **** **
* *
* * ** ** {
***** ** * ** * ** ** *
*** ** * * * ***** i++;
* * * * * * * * ** *
** ** * ** * ***** **** * * * *** * * * ***
**** ***** ** * * *** *** * *
** * *** }
*** * * * ****
* * *** * * ** * ** * c[i] = * * ** *
* *****
******** ** * * f = i + * * * * * * ** * **
* ** * * **
**** ** * *** g = f;
** * *
scanf **** * * ** ** * * *
**
while (c[f] != 34)
*****
*** ** * {
* * ** * * ***
** * *** * ** * ** f++;
* * * * ** * ****** *
* *** * ** * ** * *** * size++; *** * ** *** *
**** * * * * *
* ***** ** ** *** ** scanf ** * *** * *
* * ** * * ** * **** *
* **** ** }
**** * * **
* * ** * * * * ** * * *** * *** * ** * c[f] = * *****
** ** * **
* ** * ** **
* * * ** ***
** * while (s[u] != 32) *** *** ***** * * ** ** 判斷 * * * **
** * * * * *
* * ****** * {
* * * * * ** * * ****
* * **** ** * ** * * * * u++;
* *** * * * * ****
**** ** *** * * * * * * * ** * * * ** ***
* * ****** ** * *
* * * **** }
***** * ** **
* ** * ** *** while (s[u] != 34) **** **** * ** 判斷 **** ** **
**** ** *
* *** *** ** {
* * ** ** * ** * *** ** *
** * * * **** * ***** u++;
* * * ** * ** * ** ** *
* * ** * ** * **** * ** * * * **** * ******
** * * *** *** *** *
**** * **** }
* ** * **
***** * ** * * * *** * **** * s[u] = * * **
* ***
* ** j = u + 1;
** **
* * * * *** * **** * ** * * ** ** ** * ** ** ** * *
* * *
* ** * * ** * * ******* * **** * *
** * ** *
* ** ** *** char n[size];
*** * *****
** * ** * * for (a = g;a < * * * ** * ** ** * *
* * * *
*** * ** *** {
*** * * * ****
** * **** * *** * * *** n[k] = c[a];
* ** *** **** * * *
****** * * *** *** * * k++;
** ******* * *** * *** * **
*** }
** ***
*** * ** * * * * * **** * ** * * ** * * *
* **
* * * ** ** for (a = 0;a < size;a++)
** ** * *
* *** ** * {
* ** * * ***** * * **
** * * * ** * if (n[a] == s[j])
* **** * * ** **** **
** * * * * *** *** * ** sum++;
** * * * * * * *** ** ***
** * * * }
* * * *
* * **** *** * * ** **** * *** *
* *** * **
* * **** ** ***** ** * ** * 0;
** * * ** * *****
}
answered
Dec 12, 2016
by
410523007
(
-157
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include * **** * *
#include * ** ** * **
#include * *** *** * *
racing car was clocked at 160 miles p.h. *** ** ** ***
int ***
** * * * **
******* * * * int * ** ***** *** ** * * *
**** * * * *
* * * *** * char * *** *
** * ** * * *
* * ** * * * ** * *** ** *** * * *** *
* ** * *
** * * * ** ** while (c[i] != 34) * ** * * * ** * **
* * * **
* * **** * {
* * *** * **** *
** * * *** * * ****** i++;
* *** ** * ** * *
* ** ** ** ** ** ** ** ***** * * * * ** **
*** * * * * * * ** *
* * *** }
***** * ** **
** * * ** * * * * ** **** * c[i] = *** * ** *
* *** * **
*** * ** * * f = i + *** ** *** ** ** * * **
** * * **
* * * * ** *** g = f;
* *** ** * *
scanf ** * * * * **** * * **
* * **
while (c[f] != 34)
** **
* ** * * ** * * {
** * ** ** * ** * ** * *** *
** *** * *** *** *** ******* f++;
* ** * * ** * **** * ***
* *** * * ** ** size++; ** *** ****
* * * * *** ** * * * ***
***** * * * * *** * * scanf * * * ***** * ****
** ***** * ** * * *** * *****
** * *** }
* * *** *
** *** ***** * *** * ***** *** * * *** * ** * * c[f] = * ** *
* * *
*** * * **
* * *** * ***
**** * * * ** while (s[u] != 32) * * * ** ** *** 判斷 ** * * *
** * * ***
**** * * ** * {
* * * ** **** * * * **
* ** * *** ** * u++;
*** * * * * * ** * ** * *
* ** *** ***** * * * * ** ** * ** * * *
* **** ** * * ***
** * * **** }
** * ****
* * * * ** * while (s[u] != 34) ** * ** * *** 判斷 * ** ** * * *
** * ** **
** ** ** {
* ******* ** * * * *
* ** ** ** * * * *** u++;
** * * ** * ** ** ** *
*** * *** * *** * ** * ** **** * * * ** * *
*** * ** ** * * ** ** ** **
*** ** * }
* * * *
***** * * * * * * ** * ** * **** * * * ** s[u] = ** *
* * *** * *
** * * * j = u + 1;
** *
* * * ** * ** ***** * * ** *** * ** ***** ** * * * * ** *
** * * * *
* *** * * ** * ** ** ** * *
* ** * * *****
* ** char n[size];
** ** * *
* *** for (a = g;a < ******* * *** * *
* * *** *
* * **** {
***** * * * ** **** ****
** * * * *** ***** * n[k] = c[a];
* *** * * **** ** ** *
** * * * ****** ** * *** k++;
** * * * **** * * ***
* ** ** * }
* ***
** * ** * ** ** *** *** ** ** *** ** * ** *
* * **
* * * * *** for (a = 0;a < size;a++)
* * * **
**** * ** *** {
**** * ** **** *** * *
* * *** * ** ***** * * ** if (n[a] == s[j])
** * ** ** * ** ** * *** *
* * * * * * * sum++;
* * * ***** * ** * *
*** * * ** }
* * * ***
** * **** * * ** * *** ***** * ** *** **
* **** ** **
* ** ** * ** ** ** ** *** 0;
** * * * **** * * **
}
answered
Dec 9, 2016
by
410523007
(
-157
points)
ask related question
comment
Please
log in
or
register
to add a comment.
Page:
« prev
1
2
3
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English
中文
Tiếng Việt
IP:172.69.17.80
©2016-2025
Related questions
0
like
0
dislike
13
answers
AC 字串搜尋練習 找寶藏
[Normal]
Coding (C)
-
asked
Dec 18, 2016
in
2016-1 程式設計(一)AC
ID: 19390 -
Available when:
Unlimited
-
Due to:
Unlimited
|
1.6k
views
0
like
0
dislike
9
answers
字串搜尋AC-傻X吃飽太閒
asked
Dec 31, 2016
in
2016-1 程式設計(一)AC
by
Gulang
(
-122
points)
|
1.1k
views
0
like
0
dislike
7
answers
AC 字串練習題 判斷字串長度
[Normal]
Coding (C)
-
asked
Jan 5, 2017
in
2016-1 程式設計(一)AC
by
林佳慧
(
-85
points)
ID: 20976 -
Available when:
Unlimited
-
Due to:
Unlimited
|
814
views
0
like
0
dislike
31
answers
AC 字串練習題 判斷回文
[Normal]
Coding (C)
-
asked
Jan 3, 2017
in
2016-1 程式設計(一)AC
ID: 20482 -
Available when:
Unlimited
-
Due to:
Unlimited
|
2.8k
views
12,783
questions
183,442
answers
172,219
comments
4,824
users