Delete characters

Description

In this exercise, you will get two strings A and B in each test group and the length of every string is less than 40, you need to delete all characters which are contained in string B from string A.

The character may be space or letter.

 

Input

first line is a number n(0<n<=50), which stands for the number of test data.

the next 2*n lines contain 2*n strings, and each group of test data contain two strings A and B. There may be space in both A and B.

 

Output 

string A after delete characters, and each output is split by "\n"

if string A is null after delete, you just need to print "\n"

Sample Input

3

WE are family

aeiou

qwert

asdfg

hello world

e l

 

Sample Output

WE r fmly

qwert

howrd

 


Hint:

the string contains space, so you may need to use fgets() to input a string.

Capital letter and small letter cannot be ignored.


fgets(数组名, 数组长度, stdin?)

fgets

读取字符,不够长读完就结束此行,超出长度就只返回不完整的行




内容概要:本文以一款电商类Android应用为案例,系统讲解了在Android Studio环境下进行性能优化的全过程。文章首先分析了常见的性能问题,如卡顿、内存泄漏和启动缓慢,并深入探讨其成因;随后介绍了Android Studio提供的三大性能分析工具——CPU Profiler、Memory Profiler和Network Profiler的使用方法;接着通过实际项目,详细展示了从代码、布局、内存到图片四个维度的具体优化措施,包括异步处理网络请求、算法优化、使用ConstraintLayout减少布局层级、修复内存泄漏、图片压缩与缓存等;最后通过启动时间、帧率和内存占用的数据对比,验证了优化效果显著,应用启动时间缩短60%,帧率提升至接近60fps,内存占用明显下降并趋于稳定。; 适合人群:具备一定Android开发经验,熟悉基本组件和Java/Kotlin语言,工作1-3年的移动端研发人员。; 使用场景及目标:①学习如何使用Android Studio内置性能工具定位卡顿、内存泄漏和启动慢等问题;②掌握从代码、布局、内存、图片等方面进行综合性能优化的实战方法;③提升应用用户体验,增强应用稳定性与竞争力。; 阅读建议:此资源以真实项目为背景,强调理论与实践结合,建议读者边阅读边动手复现文中提到的工具使用和优化代码,并结合自身项目进行性能检测与调优,深入理解每项优化背后的原理。
Problem Statement You are given a string S of length N consisting of 0 and 1. You can perform the following operation on S any number of times (possibly zero): Delete the first or last character, flip it (change 0 to 1 or 1 to 0), and insert it back at any position. More formally, let r(0 )= 1 and r(1 )= 0, and perform one of the following: (Here, S i ​ denotes the i-th character of S.) Choose any i (1≤i≤N) and change S to S 2 ​ …S i ​ r(S 1 ​ )S i+1 ​ …S N ​ . Choose any i (0≤i≤N−1) and change S to S 1 ​ …S i ​ r(S N ​ )S i+1 ​ …S N−1 ​ . Find the minimum number of operations required to make all characters of S the same. It can be proved that such a sequence of operations always exists. You are given T test cases, so solve each of them. Constraints 1≤T≤2×10 5 2≤N≤5×10 5 T and N are integers. S is a string of length N consisting of 0 and 1. The sum of N over all test cases is at most 5×10 5 . Input The input is given from Standard Input in the following format: T case 1 ​ case 2 ​ ⋮ case T ​ case i ​ represents the i-th test case. Each test case is given in the following format: N S Output Output T lines. The i-th line (1≤i≤T) should contain the answer for the i-th test case. Sample Input 1 Copy 3 5 01001 3 000 15 110010111100101 Sample Output 1 Copy 4 0 16 For the first test case, for example, you can make all characters of S into 0 with four operations as follows. It is impossible to make all characters of S the same with three or fewer operations, so the answer is 4. Delete the first character 0, and insert 1 between the 1st and 2nd characters (in S after deletion). S becomes 11001. Delete the first character 1, and insert 0 between the 2nd and 3rd characters (in S after deletion). S becomes 10001. Delete the last character 1, and insert 0 at the end (in S after deletion). S becomes 10000. Delete the first character 1, and insert 0 at the beginning (in S after deletion). S becomes 00000. For the second test case, all characters of S are the same from the beginning, so no operation is needed. c++
10-05
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值