GYM 101350 I. Mirrored String II
I. Mirrored String II
题目描述
Note: this is a harder version of Mirrored string I.
The gorillas have recently discovered that the image on the surface of the water is actually a reflection of themselves. So, the next thing for them to discover is mirrored strings.
A mirrored string is a palindrome string that will not change if you view it on a mirror.
Examples of mirrored strings are “MOM”, “IOI” or “HUH”. Therefore, mirrored strings must contain only mirrored letters {A, H, I, M, O, T, U, V, W, X, Y} and be a palindrome.
e.g. IWWI, MHHM are mirrored strings, while IWIW, TFC are not.
A palindrome is a string that is read the same forwards and backwards.
Given a string S of length N, help the gorillas by printing the length of the longest mirrored substring that can be made from string S.
A substring is a (possibly empty) string of characters that is contained in another string S. e.g. “Hell” is a substring of “Hello”.
输入
The first line of input is T – the number of test cases.
Each test case contains a non-empty string S of maximum length 1000. The string contains only uppercase English letters.
输出
For each test case, output on a line a single integer - the length of the longest mirrored substring that can be made from string S.
样例
inputCopy
3
IOIKIOOI
ROQ
WOWMAN
outputCopy
4
1
3
题意
字符串处理
AC代码
GYM 101350 I. Mirrored String II相关推荐
- GYM 101350 H. Mirrored String I
题目描述 The gorillas have recently discovered that the image on the surface of the water is actually a ...
- Gym - 101350I - Mirrored String II (马拉车)
题意: 求最长回文子串,但每个字母也必须是回文的 思路: 马拉车,但奇数长度的回文串需要特判 #include <bits/stdc++.h> using namespace std; c ...
- Mirrored String I Gym - 101350H (水)判断回文
https://vjudge.net/contest/159763#problem/H 判断是不是由指定字符组成的回文串 // // main.cpp // 160929 // // Created ...
- 定间隔字符翻转(Reverse String II)
一.学习要点: 1.主要是对剩余字符长度的考虑,大于k的时候,对前k个进行翻转:小于k的时候,对实际个数进行全翻转:本程序中翻转个数用变量x来表示: 二.代码: #include<stdlib. ...
- LeetCode之Reverse String II
1.题目 Given a string and an integer k, you need to reverse the first k characters for every 2k charac ...
- 牛客 String II
文章目录 1. 题目 2. 解题 1. 题目 链接:https://ac.nowcoder.com/acm/contest/9715/B 来源:牛客网 给出一个仅包含小写字母的字符串s,你最多可以操作 ...
- LeetCode 541. Reverse String II
题目: Given a string and an integer k, you need to reverse the first k characters for every 2k charact ...
- C#LeetCode刷题之#541-反转字符串 II(Reverse String II)
问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/3951 访问. 给定一个字符串和一个整数 k,你需要对从字符串开头 ...
- GYM 101350 G. Snake Rana ( 容斥
G. Snake Rana 题目描述 Old Macdonald wants to build a new hen house for his hens. He buys a new rectangu ...
最新文章
- python公共键_Python利用公共键如何对字典列表进行排序详解
- 11G RAC ORA-32701
- Teams Bot如何做全球化
- 一文带你读懂!华为云在ACMUG技术沙龙上都透露了些啥?
- Pose-Aware Face Recognition in the Wild--填坑1
- LSI加入多核联盟参与编程与应用标准制定
- MySql解决办法:2004:Can't create TCP/IP socket (24)
- 企业微信工具栏获取外部联系人unionid
- DIY一个正弦表计算器,用于单片机查表生成正弦波
- 七 代码检查工具安装
- dimm和udimm_服务器内存UDIMM与RDIMM区别
- VR全景制作教程,拍摄VR全景图片其实很简单
- 用python的requests第三方模块抓取王者荣耀所有英雄的皮肤
- 教你画架构图,看一次就会了
- RHCE之路https网站搭建,论坛搭建
- C++中fstream
- 如何压缩图片大小到200k以下?照片太大怎么压缩到200k?
- python求素数平均值_用python怎么求素数
- IT方面学习交流群推荐
- python判断三角形是否直角_Python3如何判断三角形的类型