Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three digits.

Input

The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.

Output

Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.

Example

Input
6
549871
Output
54-98-71
Input
7
1198733
Output
11-987-33

代码:
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <cmath> using namespace std; int main()
{
int n;
char s[];
scanf("%d",&n);
scanf("%s",s);
int d = n % ;
for(int i = ;i < n;i += )
{
if(i)putchar('-');
if(d > )printf("%c%c%c",s[i ++],s[i + ],s[i + ]);
else printf("%c%c",s[i],s[i + ]);
d --;
}
}

Phone numbers的更多相关文章

  1. Java 位运算2-LeetCode 201 Bitwise AND of Numbers Range

    在Java位运算总结-leetcode题目博文中总结了Java提供的按位运算操作符,今天又碰到LeetCode中一道按位操作的题目 Given a range [m, n] where 0 <= ...

  2. POJ 2739. Sum of Consecutive Prime Numbers

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050 ...

  3. [LeetCode] Add Two Numbers II 两个数字相加之二

    You are given two linked lists representing two non-negative numbers. The most significant digit com ...

  4. [LeetCode] Maximum XOR of Two Numbers in an Array 数组中异或值最大的两个数字

    Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231. Find the maximum re ...

  5. [LeetCode] Count Numbers with Unique Digits 计算各位不相同的数字个数

    Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Examp ...

  6. [LeetCode] Bitwise AND of Numbers Range 数字范围位相与

    Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers ...

  7. [LeetCode] Valid Phone Numbers 验证电话号码

    Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bas ...

  8. [LeetCode] Consecutive Numbers 连续的数字

    Write a SQL query to find all numbers that appear at least three times consecutively. +----+-----+ | ...

  9. [LeetCode] Compare Version Numbers 版本比较

    Compare two version numbers version1 and version1.If version1 > version2 return 1, if version1 &l ...

  10. [LeetCode] Sum Root to Leaf Numbers 求根到叶节点数字之和

    Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number ...

随机推荐

  1. LeetCode:搜索旋转排序数组【33】

    LeetCode:搜索旋转排序数组[33] 题目描述 假设按照升序排序的数组在预先未知的某个点上进行了旋转. ( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2]  ...

  2. 玩转python主题模型程序库gensim

    gensim是python下一个极易上手的主题模型程序库(topic model),网址在:http://radimrehurek.com/gensim/index.html 安装过程较为繁琐,参考h ...

  3. delphi 中 unicode 转汉字 函数

    近期用到这个函数,无奈没有找到 delphi 自带的,网上找了下 有类似的,没有现成的,我需要的是 支持 “\u4f00 ” 这种格式的,即前面带标准的 “\u”  于是改造了一下. 下面是 解码 函 ...

  4. INDEL的重新比对和碱基质量分数的重新校准

    1.为什么要做这两步(why): indel的重新比对:这是由于比对软件的自身限制,其可能将包括indel的read解释为snp的read,这就导致calling的错误和后面的碱基质量分数的重新校准. ...

  5. 【简单dp】poj 1458 最长公共子序列【O(n^2)】【模板】

    最长公共子序列可以用在下面的问题时:给你一个字符串,请问最少还需要添加多少个字符就可以让它编程一个回文串? 解法:ans=strlen(原串)-LCS(原串,反串); Sample Input abc ...

  6. Apollo和分布式配置

    传统配置文件有什么缺点 如果修改了配置文件,需要重新打包发布,而且每个环境变量配置文件复杂. 分布式配置中心 将配置文件注册到配置中心平台上,可以使用分布式配置中心实时更新配置文件,统一管理,不需要重 ...

  7. java基础(4)-数组(1)

    数组:存储同一种数据类型的多个元素的容器数组初始化: 元素类型[] 数组名 = new 元素类型[数组长度]int [] arr = new int[5] 元素类型[] 数组名 = new 元素类型[ ...

  8. linux基础(1)-yum源配置

    用linux将近一年了,开始学的东西因为没经常用都忘记了,现在将笔记的东西慢慢整理成自己的博客,也算是看着自己进步.有些东西从他人博客笔记学的,有些是从视频学的,有些是自己填坑积累的. 在linux下 ...

  9. Spark 属性配置

    1.Spark1.x 属性配置方式 Spark属性提供了大部分应用程序的控制项,并且可以单独为每个应用程序进行配置. 在Spark1.0.0提供了3种方式的属性配置: SparkConf方式 Spar ...

  10. HDU 5925 离散化

    东北赛的一道二等奖题 当时学长想了一个dfs的解法并且通过了 那时自己也有一个bfs的解法没有拿出来 一直没有机会和时ji间xing来验证对错 昨天和队友谈离散化的时候想到了 于是用当时的思路做了一下 ...