AABB
来源:互联网 发布:linux做windows系统盘 编辑:程序博客网 时间:2024/06/11 19:52
AABB
Time Limit: 20 Sec
Memory Limit: 256 MB
Description
One day, Jamie noticed that many English words only use the letters A and B. Examples of such words include "AB" (short for abdominal), "BAA" (the noise a sheep makes), "AA" (a type of lava), and "ABBA" (a Swedish pop sensation).
Inspired by this observation, Jamie created a simple game. You are given two strings: initial and target. The goal of the game is to find a sequence of valid moves that will change initial into target. There are two types of valid moves:
Add the letter A to the end of the string.
Reverse the string and then add the letter B to the end of the string.
Return "Possible" (quotes for clarity) if there is a sequence of valid moves that will change initial into target. Otherwise, return "Impossible".
Input
-
The length of initial will be between 1 and 999, inclusive.
-
The length of target will be between 2 and 1000, inclusive.
-
target will be longer than initial.
-
Each character in initial and each character in target will be either 'A' or 'B'.
Output
Class:
ABBA
Method:
canObtain
Parameters:
string, string
Returns:
string
Method signature:
string canObtain(string initial, string target)
(be sure your method is public)
Sample Input
"BBBBABABBBBBBA"
"BBBBABABBABBBBBBABABBBBBBBBABAABBBAA"
Sample Output
"Possible"
HINT
- AABB
- AABB
- 【aabb 7744】
- aabb问题
- 1109 -- aabb
- 1286: aabb
- 1286:aabb
- Invalid AABB aabb,Invalid AABB a in Unity
- 建立2D AABB
- 建立2D AABB
- Box2D里的AABB
- AABB轴向包围盒
- AABB包围盒算法
- AABB类实现
- Sphere-AABB Intersecting test
- Sphere - AABB Collision Detaction
- cocos2d AABB碰撞检测
- AABB轴向包围盒
- [iOS] 如何改变一个控制器的大小?
- 【leetcode】238. Product of Array Except Self
- 理解 i++ 和++i
- Jquery跨域获得Json(三)
- Unity 插值运算 Vector3.Lerp(transform.position, targetPos, smoothing * Time.deltaTime);
- AABB
- tomcat使用redis共享session并实现单点登录
- js一百零一夜之第十四夜-正则表达式(1)
- PAT 月饼
- ceph的一些优化
- android开发 greendao学习及使用笔记
- Java Stack遍历与Vector关系
- [Unity3D]图形渲染优化、渲染管线优化、图形性能优化
- JAVA程序员养成计划之JVM学习笔记(0)-一些注意事项