题解 | #按照格式输入并交换输出#
按照格式输入并交换输出
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); } }