---
title: "九度OJ 题目1066：字符串排序"
author: "piperzero"
date: "2013-01-31T07:46:00Z"
tags: []
slug: "oj-1066"
draft: false
lastmod: "2013-03-06T20:51:33Z"
id: 1825053
url: "https://piperzero.iteye.com/blog/1825053"
---

```
/********************************* 
 *    日期：2013-1-31
 *    作者：SJF0115 
 *    题号: 九度OJ 题目1066：字符串排序
 *    来源：http://ac.jobdu.com/problem.php?pid=1066
 *    结果：AC 
 *    来源：2001年清华大学计算机研究生机试真题(第II套)
 *    总结：
**********************************/ 
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int cmp(const void * a,const void * b)
{
	return *(char *)a - *(char *)b;
}

int main()
{
	int len;
	char s[21];
	while(gets(s) != NULL)
	{
		len = strlen(s);
		qsort(s,len,sizeof(s[0]),cmp);
		puts(s);
	}
	return 0;
}
```