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. linux mint —— 图片一张

    概述 Linux Mint是一種基於Ubuntu開發出的Linux操作系统.由Linux Mint Team团队于2006年开始发行.Linux Mint 的目标是为家庭用户和企业客户提供一个免费.高 ...

  2. 关于dispatch_semaphore的使用

    dispatch_semaphore是GCD用来同步的一种方式,与他相关的共有三个函数,分别是 dispatch_semaphore_create,dispatch_semaphore_signal, ...

  3. 0802 DRF 视图

    昨日回顾: 1. Serializer(序列化) 1. ORM对应的query_set和ORM对象转换成JSON格式的数据 1. 在序列化类中定义自定义的字段:SerializerMethodFiel ...

  4. java中如何高效判断数组中是否包含某个特定的值

    四种不同方式检查数组是否包含某个值 使用List: public static boolean useList(String[] arr, String targetValue) { return A ...

  5. 关于Kinect音频开发的探究

    1.笔者在<Kinect体感程序设计入门>(王森著)的这本书中看到可以使用powershell和COM对象无缝整合,轻松的使用windows系统自带的语音合成功能. 步骤:•打开进入pow ...

  6. iptable防火墙面试题

    第1章 (一)基础口试题 1.1 详述 iptales 工作流程以及规则过滤顺序? 1.防火墙是一层层过滤的.实际是按照配置规则的顺序从上到下,从前到后进行过滤的. 2.如果匹配上了规则,即明确表明是 ...

  7. python基础语法学习常见小问题

    说明:我是最近觉得python在完成很多工作中方便使用而且功能强大,想突击学习一下.用的是廖雪峰老师的教程,学习python3.X.这里是廖雪峰老师的网站链接: http://www.liaoxuef ...

  8. 比较好的sql写法

    DECLARE @beginTime VARCHAR(20)= '2017-11-13 00:00:00';DECLARE @endTime VARCHAR(20)= '2017-11-13 23:0 ...

  9. ubuntu环境下安装Redis

    1.命令行安装 sudo apt-get update sudo apt-get install redis-server 2.启动redis $redis-server :C Aug ::42.26 ...

  10. Eclipse下利用Maven创建SpringBoot的Restful风格程序

    参考文章:https://spring.io/guides/gs/rest-service/ 中文翻译:https://blog.dubby.cn/detail.html?id=9040 1.目标是什 ...