package com;

import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class cifafenxi {

	static Scanner sc = new Scanner(System.in);

	private static List<String> Operators;
	private static List<String> Spaces;

	static {

		String[] operatorArr = { "+", "-", "*", "/", "%", "=", ">", "<", "&", "^" };
		Operators = Arrays.asList(operatorArr);

		String[] SpaceArr = { " ", "\t", "\n" };
		Spaces = Arrays.asList(SpaceArr);
	}

	static boolean isDelimiter = false;// 是否有分隔符

	static StringBuffer strb = new StringBuffer();

	public static void main(String[] args) {

		String inStr = "";

		while (!sc.hasNext("---")) {
			inStr = sc.nextLine();
			inStr = inStr + " ";
			for (char ch : inStr.toCharArray()) {
				match(ch);
			}
		}
	}

	static void match(char ch) {

		StringBuffer bouStrb = new StringBuffer();

		if (Spaces.indexOf(ch + "") >= 0) {// 是存在字符ch,存在返回true
			isDelimiter = true;
		}

		if (Operators.indexOf(ch + "") >= 0) {
			isDelimiter = true;
			bouStrb = new StringBuffer(ch + ""); // 操作符
		}

		if (isDelimiter) {
			if (strb.length() > 0) {
				if (strb.charAt(0) >= '0' && strb.charAt(0) <= '9') {
					System.out.println(strb); // 是常数
				}
			}
			if (bouStrb.length() > 0)
				System.out.println(bouStrb);
			strb.setLength(0);
			isDelimiter = false;
			return;
		}

		strb.append(ch);

	}

}
最近下载更多
121512  LV1 2021年10月30日
lgj123  LV9 2021年6月20日
生活很美好呀san  LV3 2021年6月10日
zhoupeng38  LV1 2020年12月1日
windcrane  LV1 2020年6月23日
130duyu  LV7 2020年5月25日
德莱文  LV15 2020年4月25日
温瑞希  LV6 2019年12月3日
wngauss  LV4 2019年9月26日
ye_vickers  LV2 2019年5月27日
最近浏览更多
吞吞吐吐她  LV5 3月28日
3334004690  LV3 2023年11月1日
121512  LV1 2021年10月30日
yiyiyi55555  LV1 2021年10月22日
lgj123  LV9 2021年6月20日
生活很美好呀san  LV3 2021年6月10日
luoxian 2021年6月7日
暂无贡献等级
zhoupeng38  LV1 2020年12月1日
1761203418  LV1 2020年10月17日
GikD0806  LV2 2020年8月20日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友