Remove Redundant Characters

2024-02-02 10:58
文章标签 remove characters redundant

本文主要是介绍Remove Redundant Characters,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Remove all redudant chacacters in a string.

For example, the input string is “abacaeedabcdcd”, the output will be “abced”.

Input

A string whose length is less than 100.

For example:

abacaeedabcdcd

Output

The processed string which removes all redundant chacacters.

For example:

abced

#include <stdio.h>
#include <string.h>
char input[101];
int main() {scanf("%s", input);int i, j, n = 0, m;long l = strlen(input);for (i = 0; i < l; i++) {if (input[i] != '\0') {n = input[i] - 'a';}for (j = i + 1; j <= l; j++) {m = input[j] - 'a';if (m == n) {input[j] = '\0';}}}for (i = 0; i < l; i++) {if (input[i] != '\0') {printf("%c", input[i]);}}printf("\n");return 0;
}

注意理解字符串与askii码的关系。
不见得一定要剔除一个字符,可以直接让它不print。

这篇关于Remove Redundant Characters的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/670483

相关文章

3. Longest Substring Without Repeating Characters 无重复字符的最长子串

https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ 题目大意:给一个字符串,要求出最长的不含重复字符子串(要求连续,不是子序列). 解题思路:不重复,利用哈希表.hash是以字符的ASC为下标的数组,对应存储该字符最后出现的位置. 设一个标记start,然后一次遍历

OCLint的部分规则(Redundant 部分)

OCLint的部分规则(Redundant 部分) 对OCLint的部分规则进行简单翻译解释,有部分进行了验证以及进一步分析、测试。OCLint其他相关内容如下: -- OCLint-iOS-OC项目几种简单使用OCLint的部分规则(Basic 部分)OCLint的部分规则(Unuseed 部分)OCLint的部分规则(Size 部分)OCLint的部分规则(Redundant 部分)O

remove方法

1.jQuery的remove()方法 http://www.365mini.com/page/jquery-remove.htm ①返回值是jquery对象本身 所以可以做删除再添加的操作 // 移除元素n3$n3.remove();// 将n3重新追加到n1内部的末尾$n3.appendTo("#n1"); 2:原生JS的DOM操作也有remove(); 例:docume

CentOS卸载MySQL的方法 yum remove mysql

CentOS卸载MySQL的方法 yum remove mysql [root@kypulo lampp]# rpm -qa|grep mysqlmysql-community-release-el6-5.noarchmysql-community-client-5.6.20-4.el6.i686mysql-community-libs-5.6.20-4.el6.i686mysql-commun

java List remove方法

在 Java 中,List 接口提供的 remove 方法有两个重载版本,一个是按索引移除元素,另一个是按对象移除元素。具体来说: 按索引移除元素:remove(int index) 按对象移除元素:remove(Object o) 按索引移除元素 List<String> list = new ArrayList<>();list.add("apple");list.add("bana

Characters 5 02

● 包裹● 13名男性; 12个女孩。 ● 使用地点 ● - 游戏。针对游戏引擎优化的模型; -乘法; 广告和营销; - 虚拟现实/增强现实。 ● 特点 ● -Unity模型具有人形骨架; - Fbx模型支持“Mixamo”的骨架类型; - 你可以很容易地改变物体的颜色 - 使用UV贴图; - 对象逻辑位置的枢轴; - 模型具有逻辑名称。 ● 操纵● Rig有63块骨头; ● 几何学● 25个独

Linux unlink/unlinkat/remove 函数

文章目录 一、函数声明1.1 函数各功能简述 二、实例2.1 基本使用(删除文件,与目录)2.1.1 unlink (结果,文件删除成功,无法删除目录)2.1.2 跟踪rm -r (其使用的是unlinkat系统调用)2.1.3 unlinkat (带AT_REMOVEDIR时,能删除文件夹,不带时能删除文件)2.1.4 remove(可以删除文件,或者文件夹) 2.2 创建临时文件2.2.

MacOS nodejs 安装 node-sass 报错 error: no template named ‘remove_cv_t‘ 的解决方案

MacOS Mojave执行 cnpm install node-sass 时报错如下 In file included from ../src/binding.cpp:1:In file included from ../../_nan@2.14.2@nan/nan.h:56:In file included from /Users/rumia/.node-gyp/16.2.0/in

Characters 2 01(卡通可爱人物动画模型)

● 包裹● - 26名男子; - 29个女孩。 ● 使用地点 ● - 游戏。针对游戏引擎优化的模型; -乘法; 广告和营销; - 虚拟现实/增强现实。 ● 特点 ● - 你可以很容易地改变物体的颜色 - 使用UV贴图; - 对象逻辑位置的枢轴; - 模型具有逻辑名称。 ● 几何学● 62个独特的资产(预制件); - 231k三角形全部打包; ● 人物 ● 常规(x18) Classy(x9) 运