(ProblemStatementYouaregivenastringinput.Youaretofindthelongestsubstringofproficientutsuchthatthereversalofthesubstringisalsoasubstringofinput.Incaseofatie.returnthestringthatoccursearliestininput.DefinitionClass:ReverseSubstringMethod:findReversedParameters:stringReturns:Methodsignaturestring:stringfindReversed(stringinput)(besureyourmethodispublic)TheNotesanditssubstringreversalmayoverlappartiallyorcompletely.Theentireoriginalstringisitselfavalidsubstring(seeexample4).Constraintswillinputcontainbetween1and50characters,inclusive.Eachcharacterofinputwillbeanuppercaseletter(A-Z).Examples0)"XBCDEFYWFEDCBZ"Returns:"BCDEF"Weseethereverseofthatis) - IMDN开发者社群-imdn.cn">
登录
首页 » C/C++ » ReverseSubstring

ReverseSubstring

于 2007-04-08 发布 文件大小:1KB
0 80
下载积分: 1 下载次数: 1

代码说明:

   Problem Statement You are given a string input. You are to find the longest substring of input such that the reversal of the substring is also a substring of input. In case of a tie, return the string that occurs earliest in input. Definition Class: ReverseSubstring Method: findReversed Parameters: string Returns: string Method signature: string findReversed(string input) (be sure your method is public) Notes The substring and its reversal may overlap partially or completely. The entire original string is itself a valid substring (see example 4). Constraints input will contain between 1 and 50 characters, inclusive. Each character of input will be an uppercase letter ( A - Z ). Examples 0) "XBCDEFYWFEDCBZ" Returns: "BCDEF" We see that the reverse of BCDEF is FEDCB, which appears later in the string. 1)(Problem Statement You are given a string in put. You are to find the longest substring of proficient ut such that the reversal of the substring is als o a substring of input. In case of a tie. return the string that occurs earliest in input . Definition Class : ReverseSubstring Method : findReversed Parameters : string Returns : Method signature string : string findReversed (string input) (be sure yo ur method is public) The Notes and its substring reversal may overlap partially or completely. The entire original string is itself a valid sub string (see example 4). Constraints will input contain between 1 and 50 characters, inclusive. Each character of input will be an up percase letter (A-Z). Examples 0) "XBCDEFYWFE DCBZ "Returns : "BCDEF" We see the reverse of that is)

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 696518资源总数
  • 104360会员总数
  • 40今日下载