原文:輸入一段字符(只含有空格和字母,保證開頭不為空格),里面有若干個字符串,求這些字符串的長度和,並輸出最長字符串內容,如果有多個輸出最先出現的那個字符串。以stop作為最后輸入的字符串。

include lt stdio.h gt include lt string.h gt main int i,j ,m,count,max char a while gets a count max if strcmp a, stop break for i strlen a i gt i if a i amp amp i j count else if a i i if i j count ...

2020-03-28 15:42 0 2164 推薦指數:

查看詳情

個字符串出現同樣且長度最長字符串

題目:輸入一行字符串。找出當中出現的同樣且長度最長字符串輸出它及其首字符的位置。 比如:“yyabcdabjcabceg",輸出結果應該為abc 和3. #include<iostream> #include< ...

Thu Jul 20 02:35:00 CST 2017 0 1322
 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM