With the help of fog computing, urban computing and intelligence novel systems can be created to improve the urban environment and the quality of human life. Sensor-cloud systems based on urban fog computing (SCS-UFC) are new intelligent network systems, which combine a cloud platform with wireless sensor networks (WSNs) as well as fog nodes to provide functions such as sensing, computation, and storage of large-scale data. Since the sensor nodes in WSNs only have limited transmission capacity, they cannot transmit their data to the cloud platform directly. Therefore, fog nodes with stronger transmission capacity are deployed to relay the data from WSNs to the cloud platform. However, different fog nodes may be burdened with different workloads (i.e., amounts of data): usually, the fog nodes with heavier workloads mean longer transmission delay and more energy consumption. If a fog node exhausts its energy, it will die and then make the network cease to work. Therefore, it is necessary to balance the workload of all fog nodes so as to reduce transmission delay and energy consumption of the sensors. However, addressing the problem is challenging because each fog node only knows local information of its neighbors, and thus it is difficult to get a global optimization result by itself. In this paper, a distributed intelligent algorithm based on the Hungarian method is proposed. First, each fog node collects the information connected with its neighboring fog nodes that are located within its transmission range. Then, a new genetic algorithm is designed to find an approximate optimization solution. Finally, each fog node decides if it should forward parts of its workload to other fog nodes so that the workloads of all fog nodes are balanced. Simulation results show that our algorithm can achieve shorter delay and less energy consumption than existing works.