题解 | #按照格式输入并交换输出#

按照格式输入并交换输出

https://www.nowcoder.com/practice/95eb723a3e854376a7eb6d116cc7d875

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        //找等号以后以及逗号以前的位置
        int i1 = str.indexOf(",");
        int i2 = str.indexOf("=");
        String str1 = str.substring(i2+1,i1);
        String str2 = str.substring(i1 + 3);
        System.out.println("a=" + str2 + ",b=" + str1);
    }
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
昨天 14:25
点赞 评论 收藏
分享
阿武同学:不要写至今,写具体哪年哪月毕业,专业技能往后排,项目往前排,共青团员可以不写
投了多少份简历才上岸
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务