对于给定的一个包含连续字母、连续数字及空格的字符串(不会出现字母和数字连在一起出现),实现字母部分按出现顺序排列而数字按照从小到达顺序排在最后一个字母的后面。 数据范围: 字符串长度满足 进阶:空间复杂度 , 时间复杂度
示例1
输入
"xb 1 cc 5 dd 10 ee 2"
输出
"xb cc dd ee 1 2 5 10"
示例2
输入
""
输出
""
加载中...
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ public String char_and_num_return (String text_source) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ string char_and_num_return(string text_source) { // write code here } };
#coding:utf-8 # # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param text_source string字符串 原始输入 # @return string字符串 # class Solution: def char_and_num_return(self , text_source ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ public string char_and_num_return (string text_source) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ function char_and_num_return( text_source ) { // write code here } module.exports = { char_and_num_return : char_and_num_return };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param text_source string字符串 原始输入 # @return string字符串 # class Solution: def char_and_num_return(self , text_source ): # write code here
package main import "fmt" /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ func char_and_num_return( text_source string ) string { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ char* char_and_num_return(char* text_source ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param text_source string字符串 原始输入 # @return string字符串 # class Solution def char_and_num_return(text_source) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ def char_and_num_return(text_source: String): String = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ fun char_and_num_return(text_source: String): String { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ public String char_and_num_return (String text_source) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ export function char_and_num_return(text_source: string): string { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ func char_and_num_return ( _ text_source: String) -> String { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ pub fn char_and_num_return(&self, text_source: String) -> String { // write code here } }
"xb 1 cc 5 dd 10 ee 2"
"xb cc dd ee 1 2 5 10"
""
""