根據輸入的字符串判斷字符串中數字的位置。
https://github.com/licunzhi/niuke/blob/master/src/com/sakura/aaaao/Main.java
package com.sakura.aaaao;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* @ClassName Main
* @Description 根據輸入的字符串判斷字符串中數字的位置。
* <p>
* 按類裏存儲的數個數m輸出m行。每行兩個數,表示原變量及其反向變量。
* <p>
* 輸入數據格式
* 12 3442 0
* <p>
* 輸出數據格式
* 12 21
* 3442 2443
* @Author lcz
* @Date 2019/03/21 15:19
*/
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
Integer lines = Integer.valueOf(buf.readLine());
for (int i = 0; i < lines; i++) {
String readLine = buf.readLine();
for (int i1 = 0; i1 < readLine.length(); i1++) {
if (Character.isDigit(readLine.charAt(i1))) {
System.out.print(i1 + 1 + " ");
}
}
System.out.println();
}
}
}