assignment 3

这篇博客涵盖了四个信息技术领域的基础问题:如何进行字符串压缩编码,如何判断一个新密码是否符合特定规则,如何生成斐波那契数列的字符串表示,以及如何对日期进行排序。每个问题都提供了输入和输出示例,涉及字符串操作、正则表达式、数值计算和比较算法。
摘要由CSDN通过智能技术生成

P roblem 1 String encoding                                                 

Description

Sometimes, you'll have a long string where there are many consecutive identical characters. We want to represent this long string in a string encoding way. For a sequence (length > 1) of the same characters, we can use this character and the number of repetitions, such as "aaaaaa", which we can rewrite as "a6".

Input

A string s of length less than 100 contains only lowercase letters.

Output

Your program should output an encoded string.

Example

Input

aaaaaaabbbbbcerrrrggggggggsssssspoqqqqq

 

Output

a7b5cer4g8s6poq5

 

P roblem 2 Password rules                                                 

Description

One day, you forget your OJ password and need to set a new one. Please write a program to judge whether the new password conforms to the password rules, the rules are as follows:

The password length must be between 8 and 15.

The password must contain uppercase and lowercase letters.

The password should contain digits or special characters (only #$^&* ).

The password cannot contain three or more consecutive identical letters or digits ("123", "abc" and "a1a1a1" are legal while "111", "aaa" are illegal).

Tip: You can use regular expressions to complete this problem

Java 正则表达式 | 菜鸟教程

Regular expressions in Java - Tutorial

Input

The first line only contains one integer n, n>=0.

Then following n lines, which indicate n passwords. The password contains no characters other than letters, digits, and the special characters mentioned above.

Output

Print "True" if the password matches the rules, "False" otherwise. You should verify n passwords and output n lines.

Example

Input

2

Password123 password000

 

Output

True False

 

P roblem 3 Fibonacci series                                                

Description

There exists the Fibonacci series ( a0=0,a1=1,a2=1,……). Please write a program to output the append string (a0a1……an) for a given integer n.

Input

An integer n (0<=n<=50)

Output

The append string

Data range

0<=n<=50

Example

Input

3

 

Output

0112

 

P roblem 4 Date sorting                                                       

Description

You will get many dates (a0,a1,……,an) in format "Year-Month-Day". Your task is to sort them in an ascending order and output a string containing their indices in the input.. If several dates are equal, just sort the dates in the input order. To simplify this task, we assume that every month has 31 days.

Input

Many dates in format "Year-Month-Day"

Output

The append string of the sorting result's index

Data range

1000<=Year<=3000, 1<=Month<=12, 1<=Day<=31the number of date is no more than 1000

Hint

  1. You can use hasNext to deal with the input.
  2. If you want to terminate the input in IDEA, you can use ctrl+D.

Example

Input

2001-4-5

2000-10-27

2000-1-7

2001-4-5

Output

2103

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值