当前位置:网站首页>【入门】提取不重复的整数
【入门】提取不重复的整数
2022-07-01 07:55:00 【-天道酬勤-】
描述
输入一个 int 型整数,按照从右向左的阅读顺序,返回一个不含重复数字的新的整数。保证输入的整数最后一位不是 0 。
输入描述
输入一个int型整数
输出描述
按照从右向左的阅读顺序,返回一个不含重复数字的新的整数
示例1
输入:9876673
输出:37689
<?php
fscanf(STDIN, "%d", $a);
// 转为字符串
$a .= "";
// 结果字符串
$res = '';
// 字符串长度
$len = strlen($a);
for ($i = $len - 1; $i > -1; $i--) {
if (strpos($res, $a[$i]) !== false) {
continue;
}
$res .= $a[$i];
}
echo $res;
边栏推荐
- 力扣——求一组字符中的第一个回文字符
- Missing API interface actual development series (14): ID card real name authentication verification
- Cyclic neural network
- Custom events of components ②
- Caesar
- Redisson uses the full solution - redisson official documents + comments (Part 2)
- Stepsister becomes stepmother, son breaks off relationship with himself, and musk, the world's richest man, why is it so miserable?
- Teach you how to apply for domestic trademark online step by step
- [R language] age sex frequency matching select samples for case-control study, and perform frequency matching on age and sex
- 力扣每日一题-第31天-1502.判断能否形成等差数列
猜你喜欢
Huawei modelarts training alexnet model
Discussion on several research hotspots of cvpr2022
Latex formula code
2022 test questions and mock examinations for main principals of hazardous chemicals business units
2022 test question bank and simulation test of tea master (primary) operation certificate
Eigen matrix operation Library
Thesis learning -- Analysis and Research on similarity query of hydrological time series
How relational databases work
PWN攻防世界int_overflow
Custom events of components ①
随机推荐
Sorting out tcp/udp communication problems
Teach you how to apply for domestic trademark online step by step
【R语言】两个/N个数据合并merge函数
[software] phantomjs screenshot
5大组合拳,解决校园6大难题,护航教育信息化建设
[skill] create Bat quick open web page
Vhost kick & call principle
Principle and process of embossing
Kickback -- find the first palindrome character in a group of characters
AUTOSAR learning record (1) – ECUM_ Init
Android screen adaptation (using constraintlayout), kotlin array sorting
Li Kou daily question - Day 32 -1822 Symbol of array element product
[batch DOS CMD summary] extension variables - delay variables CMD /v:on, CMD /v:off, SETLOCAL enabledelayedexpansion, disabledelayedexpansion
Caesar
力扣每日一题-第31天-1502.判断能否形成等差数列
Wang Yingqi, founder of ones, talks to fortune (Chinese version): is there any excellent software in China?
Oracle create auto increment ID
She is the "HR of others" | ones character
go通用动态重试机制解决方案的实现与封装
2022 electrician (intermediate) recurrent training question bank and answers